diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 000bb2c..3fa0b88 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -20,3 +20,5 @@ jobs: run: cargo build --verbose - name: Run tests run: cargo test --verbose + - name: CLI test + run: cd fixtures; ./test.sh diff --git a/Cargo.lock b/Cargo.lock index ab8b8a4..9aab81d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -111,16 +111,16 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "handlebars" -version = "3.5.5" +version = "5.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4498fc115fa7d34de968184e473529abb40eeb6be8bc5f7faba3d08c316cb3e3" +checksum = "d08485b96a0e6393e9e4d1b8d48cf74ad6c063cd905eb33f42c1ce3f0377539b" dependencies = [ "log", "pest", "pest_derive", - "quick-error", "serde", "serde_json", + "thiserror", ] [[package]] @@ -131,7 +131,7 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "hbs-cli" -version = "0.2.2" +version = "0.2.3" dependencies = [ "glob", "handlebars", @@ -278,12 +278,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "quick-error" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" - [[package]] name = "quote" version = "1.0.36" diff --git a/Cargo.toml b/Cargo.toml index 7a6e968..b50c63c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "hbs-cli" description = "Simple CLI for generating text from handlebars templates, by feeding them with data from file YAML/JSON." -version = "0.2.2" +version = "0.2.3" authors = [ "Jakub A. Gramsz " ] homepage = "https://github.com/olorin37/hbs-cli" repository = "https://github.com/olorin37/hbs-cli" @@ -14,7 +14,7 @@ edition = "2018" [dependencies] structopt = "0.3.26" -handlebars = "3.5.5" +handlebars = "5.0" serde = "1.0" serde_yaml = "0.9" glob = "0.3.1" diff --git a/fixtures/out_no_registration.txt b/fixtures/out_no_registration.txt deleted file mode 100644 index 8bbfe68..0000000 --- a/fixtures/out_no_registration.txt +++ /dev/null @@ -1,5 +0,0 @@ -Number: 1234567899. - -A partial: -B partial: -C partial: diff --git a/fixtures/out_standalone.txt b/fixtures/out_standalone.txt new file mode 100644 index 0000000..d6e4f71 --- /dev/null +++ b/fixtures/out_standalone.txt @@ -0,0 +1,4 @@ +Number: 1234567899. +Pi: 3.14. +Hello, I am hbs. + diff --git a/fixtures/standalone.hbs b/fixtures/standalone.hbs new file mode 100644 index 0000000..4aa06a3 --- /dev/null +++ b/fixtures/standalone.hbs @@ -0,0 +1,3 @@ +Number: {{num}}. +Pi: {{value_a}}. +Hello, I am {{value_b}}. diff --git a/fixtures/test.sh b/fixtures/test.sh index d5cddbf..16e3eaf 100755 --- a/fixtures/test.sh +++ b/fixtures/test.sh @@ -2,10 +2,11 @@ ## run it from /fixtures -# no templates registration -../target/debug/hbs-cli data.yaml template.hbs -o no_registration.txt -diff out_no_registration.txt no_registration.txt -# with registration -../target/debug/hbs-cli data.yaml template.hbs -r '**/*.hbs' -o a.txt -diff out.txt a.txt +# standalone template +../target/debug/hbs-cli data.yaml standalone.hbs -o standalone.txt +diff -u out_standalone.txt standalone.txt + +# with partials registration +../target/debug/hbs-cli data.yaml template.hbs -r '**/*.hbs' -o partials.txt +diff -u out.txt partials.txt