Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7acf6ae
run pre-commit
LebJe Dec 24, 2025
97c4892
Add FreeBSD CI
LebJe Dec 24, 2025
d043ac6
Install sudo
LebJe Dec 24, 2025
9f115ce
install bash
LebJe Dec 24, 2025
a9c1cb2
Fix install command
LebJe Dec 24, 2025
2edefa9
remove unnecessary install command
LebJe Dec 24, 2025
6230856
set bash as default shell
LebJe Dec 24, 2025
ef7fa2f
use correct shell path
LebJe Dec 24, 2025
591ee59
try disabling usesh
LebJe Dec 24, 2025
e00c1a5
Run scripts with bash
LebJe Dec 25, 2025
958a982
Use single quotes
LebJe Dec 25, 2025
13d62be
Remove unnecessary escaping
LebJe Dec 25, 2025
54be3ba
specify path to LUA_BIN_DIR
LebJe Dec 25, 2025
b3311c7
make var visible outside scope
LebJe Dec 25, 2025
cdf4b83
insert path directly
LebJe Dec 25, 2025
08b1546
use "=" in parameter
LebJe Dec 25, 2025
30aa522
/
LebJe Dec 25, 2025
1922efa
Use Lua binary name from CI matrix
LebJe Dec 25, 2025
3d042e2
fix env var
LebJe Dec 25, 2025
985385a
g++ is not a FreBSD package
LebJe Dec 25, 2025
848f92e
Don't try installing CXX_COMPILER_PACKAGE
LebJe Dec 25, 2025
f04d6f4
Don't assume compiler paths
LebJe Dec 25, 2025
780fbbd
Install Git
LebJe Dec 25, 2025
e496d9e
Ensure luarocks uses the correct lua version
LebJe Dec 26, 2025
d23728a
Make sure luarocks uses luajit
LebJe Dec 26, 2025
d68182a
Add pr-commit workflow
LebJe Dec 26, 2025
dcf8769
exclude workflow files
LebJe Dec 26, 2025
8338c02
Add all other files
LebJe Dec 26, 2025
8d90011
fix exclude expression
LebJe Dec 26, 2025
60687fe
Run pre-commit hooks.
LebJe Dec 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ A clear and concise description of what the bug is.

## Version and Installation Info

- toml.lua version:
- Operating system:
- Installation method: (Manual compilation or `luarocks install toml`)
- Compilation log, or Luarocks installation log:
- toml.lua version:
- Operating system:
- Installation method: (Manual compilation or `luarocks install toml`)
- Compilation log, or Luarocks installation log:

```shell
# Paste installation or compilation log here
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/buildAndTest-FreeBSD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: "Build and Test on FreeBSD"
on:
push:
branches:
- "main"
pull_request:

jobs:
RunTestsOnFreeBSD:
name: "FreeBSD 15"
runs-on: "ubuntu-latest"
strategy:
matrix:
compiler: ["gcc", "clang"]
lua: ["luajit", "lua54", "lua53", "lua52", "lua51"]
steps:
- uses: "actions/checkout@v6"
- name: "Setup FreeBSD VM"
uses: vmactions/freebsd-vm@v1
id: vm
with:
#usesh: true
prepare: |
pkg update
pkg install -y sudo bash
- name: "Add Dependencies"
shell: freebsd {0}
run: |
bash -xc '
cd $GITHUB_WORKSPACE
export COMPILER=${{ matrix.compiler }}
source ./scripts/compilerName.sh
sudo pkg install -y cmake git ${{ matrix.lua }} "$C_COMPILER_PACKAGE"
export LUA_BIN_NAME=${{ matrix.lua }}
case ${{ matrix.lua }} in
*lua54*)
bash -x scripts/buildLuaRocks.sh "5.4"
;;
*lua53*)
bash -x scripts/buildLuaRocks.sh "5.3"
;;
*lua52*)
bash -x scripts/buildLuaRocks.sh "5.2"
;;
*lua51*)
bash -x scripts/buildLuaRocks.sh "5.1"
;;
*luajit*)
bash -x scripts/buildLuaRocks.sh "5.1"
;;
*)
bash -x scripts/buildLuaRocks.sh
;;
esac
sudo luarocks
sudo luarocks install luaunit
'
- name: "Build Project"
shell: freebsd {0}
run: |
bash -xc '
cd $GITHUB_WORKSPACE
export COMPILER=${{ matrix.compiler }}
source scripts/compilerName.sh
sudo luarocks config "variables.CMAKE_CXX_COMPILER" "$CXX_COMPILER"
sudo luarocks config "variables.CMAKE_C_COMPILER" "$C_COMPILER"
sudo CXX="$CXX_COMPILER" CC="$C_COMPILER" luarocks make
'
- name: "Test Project"
shell: freebsd {0}
run: |
bash -xc '
cd $GITHUB_WORKSPACE
${{ matrix.lua }} tests/tests.lua
'
2 changes: 1 addition & 1 deletion .github/workflows/buildAndTest-Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
source scripts/compilerName.sh
sudo apt update
sudo apt install -yq ${{ matrix.lua }} "$C_COMPILER_PACKAGE" "$CXX_COMPILER_PACKAGE"
./scripts/buildLuaRocks.sh
bash scripts/buildLuaRocks.sh
sudo luarocks install luaunit
- name: "Build Project"
run: |
Expand Down
29 changes: 24 additions & 5 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
name: "Run Pre-Commit"

name: "Run pre-commit"
on:
push:
branches:
- "main"

pull_request:

jobs:
PreCommit:
permissions:
contents: "write"
runs-on: "macos-latest"
steps:
- uses: "actions/checkout@v4"
- uses: "actions/checkout@v6"
with:
ref: ${{ github.head_ref }}
- name: "Install Dependencies"
run: "brew bundle"
- uses: "LebJe/pre-commit-composite-action@0.0.1"
- name: "Run Pre-Commit"
id: "run-pre-commit"
run: |
EXIT_CODE=0
pre-commit run --all --color=always --show-diff-on-failure || EXIT_CODE=$?
if [[ $EXIT_CODE -ne 0 ]]; then
echo "SHOULD_COMMIT=true" >> "$GITHUB_OUTPUT"
else
echo "SHOULD_COMMIT=false" >> "$GITHUB_OUTPUT"
fi;
- uses: stefanzweifel/git-auto-commit-action@v7
if: contains(steps.run-pre-commit.outputs.SHOULD_COMMIT, 'true')
with:
commit_message: "Run pre-commit hooks."
file_pattern: ". :(exclude).github/workflows/*"

4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: "https://github.com/pre-commit/mirrors-prettier.git"
rev: "v4.0.0-alpha.8"
- repo: "https://github.com/rbubley/mirrors-prettier.git"
rev: "v3.7.4"
hooks:
- id: "prettier"
name: "Format YAML & Markdown"
Expand Down
80 changes: 40 additions & 40 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- The formatting options that were passed as a parameter to `toml.encode`, `toml.encodeToFile`, `toml.toJSON`, and `toml.toYAML` previously had no effect when overriding values.
- Resolved CMake `FetchContent_Populate` warning.
- The formatting options that were passed as a parameter to `toml.encode`, `toml.encodeToFile`, `toml.toJSON`, and `toml.toYAML` previously had no effect when overriding values.
- Resolved CMake `FetchContent_Populate` warning.

### Changed

- Updated to magic_enum v0.9.7.
- Updated to magic_enum v0.9.7.

### Added

- Added tests for encoding options.
- Added tests for encoding options.

## [0.4.0](https://github.com/LebJe/toml.lua/releases/tag/0.4.0) - 2024-01-02

### Added

- `toml.Int` for formatted integers.
- `toml.Int` for formatted integers.

```lua
local formattedIntegers = {
Expand All @@ -41,39 +41,39 @@ int3 = 0x169F
--]]
```

- `formattedIntsAsUserdata` can be passed to the options table of `toml.decode` (see "Decoding Options" in the README).
- Updated to toml++ v3.4.0.
- Updated to MagicEnum v0.9.5.
- toml.lua compiles with MSVC.
- `formattedIntsAsUserdata` can be passed to the options table of `toml.decode` (see "Decoding Options" in the README).
- Updated to toml++ v3.4.0.
- Updated to MagicEnum v0.9.5.
- toml.lua compiles with MSVC.

## [0.3.0](https://github.com/LebJe/toml.lua/releases/tag/0.3.0) - 2023-02-19

### Added

- `toml.decodeFromFile(filePath: string)`:
- Decodes a TOML document at `filePath`. Throws the same errors as `toml.decode`.
- `toml.encodeToFile(data: table, fileOrOptions: string|table)`:
- Encodes `data` to the file specified in `fileOrOptions`. the file will be created if it doesn't exist.
- When `fileOrOptions` is a string, it simply is the file path.
- When `fileOrOptions` is a table, it should have`file`, and optionally, `overwrite` as keys. `file` is the file path, and `overwrite` should be `true` when `file` should be overwritten with `data`, and `false` when `data` should be appended to `file`.
- Added tests that cover:
- The property accessors of `toml.Date`, `toml.Time`, `toml.DateTime`, and `toml.TimeOffset`.
- `toml.toJSON` and `toml.toYAML`.
- `toml.decodeFromFile(filePath: string)`:
- Decodes a TOML document at `filePath`. Throws the same errors as `toml.decode`.
- `toml.encodeToFile(data: table, fileOrOptions: string|table)`:
- Encodes `data` to the file specified in `fileOrOptions`. the file will be created if it doesn't exist.
- When `fileOrOptions` is a string, it simply is the file path.
- When `fileOrOptions` is a table, it should have`file`, and optionally, `overwrite` as keys. `file` is the file path, and `overwrite` should be `true` when `file` should be overwritten with `data`, and `false` when `data` should be appended to `file`.
- Added tests that cover:
- The property accessors of `toml.Date`, `toml.Time`, `toml.DateTime`, and `toml.TimeOffset`.
- `toml.toJSON` and `toml.toYAML`.

### Changed

- `toml.tomlToJSON` and `toml.tomlToYAML` have been renamed to `toml.toJSON` and `toml.toYAML`.
- They have been renamed because they now have two functions: converting a TOML string to JSON/YAML (as before), or converting a table into JSON/YAML.
- The first parameter can be a string containing TOML (as before), or a table.
- `toml.tomlToJSON` and `toml.tomlToYAML` have been renamed to `toml.toJSON` and `toml.toYAML`.
- They have been renamed because they now have two functions: converting a TOML string to JSON/YAML (as before), or converting a table into JSON/YAML.
- The first parameter can be a string containing TOML (as before), or a table.

## [0.2.0](https://github.com/LebJe/toml.lua/releases/tag/0.2.0) - 2023-02-12

### Added

- Updated to toml++ v3.3.0
- Added `terseKeyValuePairs` to the list of formatting options for `toml.encode`
- Tables can be made inline.
- `toml.decode` can decode date, time and date-time into userdata (as before) or plain tables:
- Updated to toml++ v3.3.0
- Added `terseKeyValuePairs` to the list of formatting options for `toml.encode`
- Tables can be made inline.
- `toml.decode` can decode date, time and date-time into userdata (as before) or plain tables:

```lua
local tomlStr = [[
Expand Down Expand Up @@ -126,63 +126,63 @@ int3 = 0x169F
--]]
```

- Test suite now runs on Windows
- Test suite now runs on Windows

### Changed

- Use [luaunit](https://github.com/bluebird75/luaunit) instead of [busted](https://github.com/lunarmodules/busted) for testing
- `quoteDatesAndTimes` now defaults to `false`.
- Use [luaunit](https://github.com/bluebird75/luaunit) instead of [busted](https://github.com/lunarmodules/busted) for testing
- `quoteDatesAndTimes` now defaults to `false`.

### Fixed

- Boolean values are decoded as booleans instead of integers. (#6)
- Boolean values are decoded as booleans instead of integers. (#6)

## [0.1.1](https://github.com/LebJe/toml.lua/releases/tag/0.1.1) - 2022-06-14

### Added

- Windows support.
- Windows support.

## [0.1.0](https://github.com/LebJe/toml.lua/releases/tag/0.1.0) - 2022-04-08

### Added

- Upgrade to [toml++ 3.0.1](https://github.com/marzer/tomlplusplus/releases/tag/v3.0.1)
- TOML documents can be converted to JSON or YAML.
- Formatting options can be passed to the `encode`, `tomlToJSON`, and `tomlToYAML` functions.
- Upgrade to [toml++ 3.0.1](https://github.com/marzer/tomlplusplus/releases/tag/v3.0.1)
- TOML documents can be converted to JSON or YAML.
- Formatting options can be passed to the `encode`, `tomlToJSON`, and `tomlToYAML` functions.

### Removed

- Removed `formattedReason` from decoding error messages.
- Removed `formattedReason` from decoding error messages.

## [0.0.4](https://github.com/LebJe/toml.lua/releases/tag/0.0.4) - 2021-11-24

### Added

- toml.lua is now tested with `g++` and `clang++` with Lua 5.3, 5.2, 5.1 and LuaJIT.
- toml.lua is now tested with `g++` and `clang++` with Lua 5.3, 5.2, 5.1 and LuaJIT.

### Changed

- toml.lua now depends on Lua 5.1, instead of Lua 5.3.
- toml.lua now depends on Lua 5.1, instead of Lua 5.3.

## [0.0.3](https://github.com/LebJe/toml.lua/releases/tag/0.0.3) - 2021-11-08

### Added

- Date, time, and date-time types.
- Date, time, and date-time types.

### Fixed

- Integers are now inserted into TOML documents as integers, not floating-point numbers.
- Integers are now inserted into TOML documents as integers, not floating-point numbers.

## [0.0.2](https://github.com/LebJe/toml.lua/releases/tag/0.0.2) - 2021-10-29

### Added

- The `decode` and `tomlToJSON` functions now return a table containing error details instead of a string if parsing a TOML document fails.
- The `decode` and `tomlToJSON` functions now return a table containing error details instead of a string if parsing a TOML document fails.

## [0.0.1](https://github.com/LebJe/toml.lua/releases/tag/0.0.1) - 2021-10-27

### Added

- Initial Release.
- Initial Release.
Loading