- provide cli command to render erb template
- template params (bindings) to be provided using json format
- use inputs from file (template.erb, params.json)
- use inputs from cli options / parameters
- render output to stdout OR to file
- helps creating build & deploy pipelines
$ ruby json_erb_render.rb --help
$ ruby json_erb_render.rb -i ./example/foo.erb -d ./example/config.json
$ ruby json_erb_render.rb -i ./example/foo.erb -d ./example/config.json -o ./out.txt
$ ruby json_erb_render.rb -t "FOO_BAR=<%= @config['foo'] %>" -d ./example/config.json
$ ruby json_erb_render.rb -t "FOO_BAR=<%= @config['foo'] %>" -p "{"foo":"bar"}"
$ ruby json_erb_render.rb -t "FOO_BAR=<%= @config['foo'] %>" -p "{"foo":"bar"}" -o ./out.txt
-
no need to install ruby
-
just run against official ruby image
$ docker run --rm -it
-e "$$PATH=$(PATH)"
--volume "$(PWD)":"/src" -w /src
ruby:2.3
ruby /src/example/json_erb_render.rb -i /src/example/foo.erb -d /src/example/config.json
- no proper validations implemented, ruby will throw its exceptions if sth. is wrong
This is fantastic. Could you turn this into a git repo so pull requests could be made? I'd like to add YAML support and some other functionality.