Mustache project templates using Python and Groome
Project description
Molt
Molt is a script to stub out projects in any language instantly using Mustache-based project templates.
You can use Molt to decrease the amount of boilerplate code you need to write when starting new projects: the README, copyright notices, license info, logging configuration, option parsing, test harness, packaging information, .gitignore, directory hierarchy, etc.
A minimal sample usage looks like–
$ molt -c path_to_config.json path_to_template_dir/
Molt follows the Groome rules for Mustache-based project templates. See the Groome page for project template syntax. This version of Molt follows version 0.1.0 of Groome.
Molt is written in Python and can be found on GitHub and on PyPI (the Python Package Index).
Feedback is welcome. You can also file bug reports and feature requests on the GitHub issues page.
Requirements
Molt supports the following Python versions:
Python 2.7
Python 3.x support is coming soon. Since Molt is a development tool, there are no plans to support Python 2.6 or earlier.
Molt’s dependencies are–
The installation process below installs these dependencies automatically.
Both setuptools and Distribute (preferred) are supported for installing.
Install It
$ pip install molt
Test it
$ molt --run-tests
Try it
Start with the demo Groome template to play with:
$ molt --create-demo --output demo $ ls -p demo expected/ lambdas/ partials/ sample.json structure/
Render the template with the sample context provided:
$ molt --output output --config demo/sample.json demo
Run the newly-created project (which can also be seen here)):
$ python output/hello.py world Hello, world!
For help documentation and available options–
$ molt -h
Note the --visualize and --with-visualize options that let you quickly visualize entire directory contents.
$ molt --visualize output
If using Python, you can also use Molt as a library (though the API is not yet stable). See the Molter class in the `molt.molter <https://github.com/cjerdonek/molt/blob/master/molt/molter.py>`_ module.
Contribute
If using GitHub, after forking–
$ git clone git@github.com:yourusername/molt.git $ cd molt $ git remote add upstream git://github.com/cjerdonek/molt.git $ git fetch upstream
To run unit tests–
$ python test_molt.py
To test Molt with multiple versions of Python (with a single command!), you can use tox:
pip install tox tox
If you don’t have all Python versions listed in tox.ini, you can do–
tox -e py27 # for example
To run from source any molt command of the form–
$ molt [options] [DIRECTORY]
simply type–
$ python -m molt.commands.molt [options] [DIRECTORY]
To include the Groome tests in your test runs, initialize and update the Groome project submodule–
$ git submodule init $ git submodule update
To run a subset of the tests, you can filter your test runs using one or more prefixes. For example–
$ python test_molt.py molt.test.common molt.test.dir
Copyright
Copyright (C) 2011-2012 Chris Jerdonek. All rights reserved.
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.
The names of the copyright holders may not be used to endorse or promote products derived from this software without specific prior written permission.
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.
History
0.1.0 (2012-06-30)
Initial release (for Python 2.7 and PyPy).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file molt-0.1.0.tar.gz
.
File metadata
- Download URL: molt-0.1.0.tar.gz
- Upload date:
- Size: 66.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60403c7ba3fbb97af50d0c52a947e6a88e1115b4677ff1903fd2d8e99cafb3a7 |
|
MD5 | d52e0e12bbff6d2841c70999217ac748 |
|
BLAKE2b-256 | 2ac781b21ff0764adb1fc2f908c77d5f514c4d01d7427ce5d395dc12bcc8a7ab |