Skip to content
Snippets Groups Projects
Commit 4bf67215 authored by nimrod's avatar nimrod
Browse files

- First commit.

parents
No related branches found
No related tags found
No related merge requests found
*~
~*
*.swp
*.swo
*.pyc
.DS_Store
build/
dist/
*.egg-info/
__pycache__/
*.log
.tox
.cache
This diff is collapsed.
recursive-include eb-prune *.py
exclude .pre-commit-config.yaml
include README.rst
include VERSION
Template
########
A CLI tool for generating files from Jinja2 templates and environment variables.
TODO
----
- Input/output detection/redirection.
- Complex data types (process environment variables, Jinja filters).
0.0.1
[bdist_wheel]
universal=1
[flake8]
exclude = .tox,*.egg,build,data
select = E,W,F
setup.py 0 → 100644
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='template',
version=open('VERSION', 'r').read(),
description='A CLI tool for generating files from Jinja2 templates and
environment variables.',
long_description=open('README.rst', 'r').read(),
url='https://www.shore.co.il/git/template',
author='Nimrod Adar',
author_email='nimrod@shore.co.il',
license='MIT',
classifiers=[
'Development status :: 4 - Beta',
'Intended Audience :: Developers',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 2',
'Intended Audience :: System Administrators',
'Topic :: Utilities',
],
keywords='config configuration jinja template environment',
packages=find_packages(),
install_requires=['Jinja2'],
extras_require={
'dev': ['tox'], },
entry_points={
'console_scripts': [
'template=template:main'], },
)
#!/usr/bin/env python
'''Generate files from Jinja2 templates and environment variables.'''
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from jinja2 import FileSystemLoader, DictLoader
from jinja2.environment import Environment
from os import environ
from sys import stdin, argv
def render(template):
env = Environment()
return env.from_string(template).render(environ)
def usage():
raise NotImplemented
def main():
template=stdin.read()
print(render(template))
if __name__ == '__main__':
main()
tox.ini 0 → 100644
[tox]
envlist = py{2,3}
[testenv]
basepython =
py2: python2
py3: python3
deps =
check-manifest
readme_renderer
flake8
commands =
check-manifest --ignore tox.ini,tests*
python setup.py check -m -r -s
flake8 .
[testenv:release]
basepython = python
whitelist_externals =
sh
deps =
twine
wheel
commands =
sh -c 'git tag -f "$(cat VERSION)"'
python setup.py bdist_wheel
# 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