Skip to content
Snippets Groups Projects
Commit 03c86c47 authored by nimrod's avatar nimrod
Browse files

Merge branch 'master' into feature/toml

parents 3b73f085 e92146b1
No related branches found
No related tags found
No related merge requests found
......@@ -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:
......
---
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
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?
......@@ -36,5 +36,6 @@ def main():
outfd = args.output if args.output else stdout
print(render(infd.read()), file=outfd)
if __name__ == '__main__':
main()
......@@ -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"
......
[tox]
envlist = py{2,3}
[travis]
python =
2.7: py2
3.2: py3
3.3: py3
3.4: py3
3.5: py3
[testenv]
basepython =
py2: python2
......@@ -25,4 +33,4 @@ deps =
commands =
sh -c 'git tag -f "$(cat VERSION)"'
python setup.py bdist_wheel
# twine upload --skip-existing dist/*.whl
twine upload --skip-existing dist/*.whl
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment