jinja2-cli 0.6.0 (new formula)
Closes #36691. Signed-off-by: FX Coudert <fxcoudert@gmail.com>
This commit is contained in:
parent
50d77d74ed
commit
90d47ed6bb
1 changed files with 58 additions and 0 deletions
58
Formula/jinja2-cli.rb
Normal file
58
Formula/jinja2-cli.rb
Normal file
|
@ -0,0 +1,58 @@
|
|||
class Jinja2Cli < Formula
|
||||
include Language::Python::Virtualenv
|
||||
|
||||
desc "CLI for the Jinja2 templating language"
|
||||
homepage "https://github.com/mattrobenolt/jinja2-cli"
|
||||
url "https://files.pythonhosted.org/packages/50/24/a774867a93c19d21f132154b509ad014ab22106e1927d0241b556cf8c836/jinja2-cli-0.6.0.tar.gz"
|
||||
sha256 "4b1be17ce8a8f133df02205c3f0d3ebfc3a68e795d26987f846a2316636427b7"
|
||||
|
||||
depends_on "python"
|
||||
|
||||
resource "jinja2" do
|
||||
url "https://files.pythonhosted.org/packages/56/e6/332789f295cf22308386cf5bbd1f4e00ed11484299c5d7383378cf48ba47/Jinja2-2.10.tar.gz"
|
||||
sha256 "f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4"
|
||||
end
|
||||
|
||||
resource "MarkupSafe" do
|
||||
url "https://files.pythonhosted.org/packages/ac/7e/1b4c2e05809a4414ebce0892fe1e32c14ace86ca7d50c70f00979ca9b3a3/MarkupSafe-1.1.0.tar.gz"
|
||||
sha256 "4e97332c9ce444b0c2c38dd22ddc61c743eb208d916e4265a2a3b575bdccb1d3"
|
||||
end
|
||||
|
||||
def install
|
||||
virtualenv_install_with_resources
|
||||
end
|
||||
|
||||
test do
|
||||
assert_match version.to_s, shell_output("script -q /dev/null #{bin}/jinja2 --version")
|
||||
expected_result = <<~EOS
|
||||
The Beatles:
|
||||
- Ringo Starr
|
||||
- George Harrison
|
||||
- Paul McCartney
|
||||
- John Lennon
|
||||
EOS
|
||||
template_file = testpath/"my-template.tmpl"
|
||||
template_file.write <<~EOS
|
||||
{{ band.name }}:
|
||||
{% for member in band.members -%}
|
||||
- {{ member.first_name }} {{ member.last_name }}
|
||||
{% endfor -%}
|
||||
EOS
|
||||
template_variables_file = testpath/"my-template-variables.json"
|
||||
template_variables_file.write <<~EOS
|
||||
{
|
||||
"band": {
|
||||
"name": "The Beatles",
|
||||
"members": [
|
||||
{"first_name": "Ringo", "last_name": "Starr"},
|
||||
{"first_name": "George", "last_name": "Harrison"},
|
||||
{"first_name": "Paul", "last_name": "McCartney"},
|
||||
{"first_name": "John", "last_name": "Lennon"}
|
||||
]
|
||||
}
|
||||
}
|
||||
EOS
|
||||
output = shell_output("#{bin}/jinja2 #{template_file} #{template_variables_file}")
|
||||
assert_equal output, expected_result
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue