An easy way to create a tool to generate code boilerplates like "npm init" and "vue create" for any programming language.
Project description
Boilee
An easy way to create a tool to generate code boilerplates like npm init
and vue create
for any programming language.
Main features:
- Read arguments and inputs of the user;
- Manipulate the files using templates;
- Manipulate the file tree using templates;
Installation
Obtain the executable
You can get here the executables for Windows and Linux
Installing via pip
You can install boilee via pip on your system (or on a venv) with the following command:
pip install boilee
Installing from source code
To get the executable from the source see the build section
Usage
# Create a zip file that contains all the information of the boilerplate:
boilee make <input-directory> <output-file>
# Generate boilerplate
boilee run <input-file> [...boilerplate-options]
Example
Create the following files:
# example_boilerplate/project/scripts/python3.py
def main():
print("Message from Python 3:")
print("{{ message }}")
if __name__ == "__main__":
main()
# example_boilerplate/project/scripts/python2.py
def main():
print "Message from Python 2:"
print "{{ message }}"
if __name__ == "__main__":
main()
# example_boilerplate/.boilee/structure.yml
{{ project_name }} @content=project: # Creates a directory with a name provided by the user with the content of the "project" directory
scripts: # "scripts" directory
python{{ python-version }}.py
# example_boilerplate/.boilee/parameters.yml
project_name:
input-type: input
parameter_type: argument
message: Enter the project name
python-version:
input-type: list
message: Select a Python version
choices:
- choice:
message: "Python 3"
value: 3
- choice:
message: "Python 2"
value: 2
message:
input-type: input
message: Enter a message
Create a zip file that contains all the information of the boilerplate:
boilee make example_boilerplate example.zip
Generate boilerplate and test:
boilee run example.zip example_python3 --python-version=3 --message=Hi!
python3 example_python3/scripts/python3.py
# Result
Message from Python 3:
Hi!
boilee run example.boilerplate example_python2 --python-version=2 --message=Hi!
python2 example_python2/scripts/python2.py
# Result
Message from Python 2:
Hi!
If a parameter is not provided it will be requested later.
Contributing
Build
By default boilee uses pyoxidizer to generate an executable.
To generate an executable with pyoxidizer (if pyoxidizer is already installed) run the command:
pyoxidizer run
License
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.