Clean-up before the remake

This commit is contained in:
Mark Vartanyan 2014-06-25 13:54:39 +02:00
parent 19d973d701
commit f10bc10aaa
7 changed files with 104 additions and 85 deletions

59
.gitignore vendored
View File

@ -1,33 +1,42 @@
*.py[cod]
# ===[ APP ]=== #
# C extensions
*.so
# ===[ PYTHON PACKAGE ]=== #
/build/
/dist/
/MANIFEST
/*.egg-info/
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
# ===[ OTHER ]=== #
# Installer logs
pip-log.txt
# IDE Projects
.idea
.nbproject
.project
*.sublime-project
# Unit test / coverage reports
# Temps
*~
*.tmp
*.bak
*.swp
*.kate-swp
*.DS_Store
Thumbs.db
# Utils
.sass-cache/
.coverage
.tox
nosetests.xml
#Translations
# Generated
__pycache__
*.py[cod]
*.pot
*.mo
#Mr Developer
.mr.developer.cfg
# Runtime
/*.log
/*.pid
# ===[ EXCLUDES ]=== #
!.gitkeep
!.htaccess

24
LICENSE
View File

@ -1,9 +1,23 @@
Copyright (c) 2012, Matt Robenolt
Copyright (c) 2014, Mark Vartanyan
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,4 +0,0 @@
publish:
python setup.py sdist upload
.PHONY: publish

View File

@ -1,32 +1,13 @@
# $ jinja2
A CLI interface to Jinja2
```
$ jinja2 helloworld.tmpl data.json --format=json
$ cat data.json | jinja2 helloworld.tmpl
$ curl -s http://httpbin.org/ip | jinja2 helloip.tmpl
$ curl -s http://httpbin.org/ip | jinja2 helloip.tmpl > helloip.html
```
j2cli - Jinja2 Command-Line Tool
================================
## Install
`$ pip install jinja2-cli`
`j2cli` is a command-line tool for templating in shell-scripts,
leveraging the [Jinja2](http://jinja.pocoo.org/docs/) library.
## Installation
```
pip install j2cli
```
## Usage
```
Usage: jinja2 [options] <input template> <input data>
Options:
--version show program's version number and exit
-h, --help show this help message and exit
--format=FORMAT Format of input variables: yaml, json, querystring, ini
```
## Optional YAML support
If PyYAML is present, you can use YAML as an input data source.
`$ pip install pyyaml`
## TODO
* Variable inheritance and overrides
* Make environment variables accessible to templates
* Pass through m4/gcc-like variables: `jinja2 -Dname=matt`
* Tests!

View File

@ -5,7 +5,7 @@ jinja2-cli
License: BSD, see LICENSE for more details.
"""
from jinja2cli import __version__
from j2cli import __version__
class InvalidDataFormat(Exception): pass
class InvalidInputData(Exception): pass

View File

@ -1,42 +1,61 @@
#!/usr/bin/env python
"""
jinja2-cli
j2cli
==========
A CLI interface to jinja2.
Command-line interface to [Jinja2](http://jinja.pocoo.org/docs/) for templating in shell scripts.
$ jinja2 helloworld.tmpl data.json --format=json
$ cat data.json | jinja2 helloworld.tmpl
$ curl -s http://httpbin.org/ip | jinja2 helloip.tmpl
$ curl -s http://httpbin.org/ip | jinja2 helloip.tmpl > helloip.html
Features:
* Jinja2 templating
* Allows to use environment variables
* YAML or JSON data sources supported
Usage:
$ j2 config.j2 data.json --format=json
$ cat data.json | j2 config.j2
Based on [mattrobenolt/jinja2-cli](https://github.com/mattrobenolt/jinja2-cli)
"""
from setuptools import setup, find_packages
setup(
name='jinja2-cli',
version='0.2.0',
author='Matt Robenolt',
author_email='matt@ydekproductions.com',
url='https://github.com/mattrobenolt/jinja2-cli',
description='A CLI interface to Jinja2',
long_description=__doc__,
packages=find_packages(),
zip_safe=False,
name='j2cli',
version='0.3.0-0',
author='Mark Vartanyan',
author_email='kolypto@gmail.com',
url='https://github.com/kolypto/j2cli',
license='BSD',
install_requires=[
'jinja2',
],
include_package_data=True,
description='Command-line interface to Jinja2 for templating in shell scripts.',
long_description=__doc__,
keywords=['Jinja2', 'templating', 'command-line', 'CLI'],
packages=find_packages(),
scripts=[],
entry_points={
'console_scripts': [
'jinja2 = jinja2cli:main',
'j2 = j2cli:main',
]
},
install_requires=[
'jinja2 >= 2.7.2',
],
include_package_data=True,
zip_safe=False,
platforms='any',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Operating System :: OS Independent',
'Topic :: Software Development'
'Topic :: Software Development',
'Natural Language :: English',
'Programming Language :: Python :: 2',
#'Programming Language :: Python :: 3',
],
)