Commit 03c86c47 authored by nimrod's avatar nimrod
Browse files

Merge branch 'master' into feature/toml

parents 3b73f085 e92146b1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -6,6 +6,8 @@
    -   id: check-xml
    -   id: check-yaml
    -   id: check-merge-conflict
    -   id: flake8
    -   id: check-symlinks
-   repo: https://www.shore.co.il/git/shell-pre-commit/
    sha: 604fe77b53d3514d5ad0f66764c7783850bb6e98
    hooks:

.travis.yml

0 → 100644
+16 −0
Original line number Diff line number Diff line
---
language: python
python: ["2.7", "3.3", "3.4", "3.5"]
dist: trusty
sudo: false
cache:
  - pip

install:
    - pip install tox-travis

script:
  - tox

notifications:
  email: false
+23 −0
Original line number Diff line number Diff line
Template
########

.. image:: https://travis-ci.org/adarnimrod/template.svg?branch=master
    :target: https://travis-ci.org/adarnimrod/template

A CLI tool for generating files from Jinja2 templates and environment
variables.

@@ -47,6 +50,18 @@ The following Jinja filters were added:

Example usage can be seen in :code:`tests.sh`.

Testing
-------

Local tests require both a Python 2, Python 3 and Tox installed and can be run
by running :code:`tox`. Alternatively, Travis CI is used to test on multiple
versions of Python for every push.

Release
-------

Currently releases are done locally by running :code:`tox -e release` and
require Python and Tox installed. Releases with Travis CI are coming.

License
-------
@@ -61,3 +76,11 @@ Nimrod Adar, `contact me <nimrod@shore.co.il>`_ or visit my `website
<https://www.shore.co.il/>`_. Patches are welcome via `git send-email
<http://git-scm.com/book/en/v2/Git-Commands-Email>`_. The repository is located
at: https://www.shore.co.il/git/.

TODO
----

- Fix combining dictionaries test.
- Fix Travis CI test on Python 3.2 (https://travis-ci.org/adarnimrod/template/jobs/187388235).
- Release on tagged commits to PyPI in Travis CI.
- TOML support?
+1 −0
Original line number Diff line number Diff line
@@ -36,5 +36,6 @@ def main():
    outfd = args.output if args.output else stdout
    print(render(infd.read()), file=outfd)


if __name__ == '__main__':
    main()
+6 −5
Original line number Diff line number Diff line
@@ -9,9 +9,10 @@ export name='John'
test "$(echo 'Hello {{ name if name is defined else 'world' }}.' | template)" = "Hello John."

echo Testing arguments and reading/ writing to file.
echo '{{ USER }}' > "$infile"
echo '{{ name }}' > "$infile"
export name='John'
template --output "$outfile" "$infile"
test "$(cat $outfile)" = "$USER"
test "$(cat $outfile)" = "$name"

echo Testing JSON parsing.
export json='{"a": 1, "b": 2}'
@@ -36,9 +37,9 @@ echo Testing pprint.
echo '{{ [1, ] + [2, ] }}' > "$infile"
test "$(template $infile)" = "[1, 2]"

echo Testing combining dictionaries.
echo '{{ {"a": 1, "b": 2}|combine({"a": 11, "c": 33}) }}' > "$infile"
test "$(template $infile)" = "{'a': 11, 'c': 33, 'b': 2}"
# echo Testing combining dictionaries.
# echo '{{ {"a": 1, "b": 2}|combine({"a": 11, "c": 33}) }}' > "$infile"
# test "$(template $infile)" = "{'a': 11, 'c': 33, 'b': 2}"

echo Testing TOML parsing.
echo '{{ "[table]\n key = value" | from_toml }}' > "$infile"
Loading