jneug / parboil Goto Github PK
View Code? Open in Web Editor NEW:rice: Parboil lets you generate boilerplate projects from template files.
License: MIT License
:rice: Parboil lets you generate boilerplate projects from template files.
License: MIT License
Make -m
the default for boil install
(merge template in existing directory) and replace -f
with a --hard
option, that deletes the target dir first.
It would be nice if projects could include other project templates during compilation. For example a "java-project" template could run a "license" template, the adds a license file to the project. The "python-project" template could reference the same "sub-template" to include a license.
At some point this would probably require some kind of dependency management? But for now the compilation process could just display a warning and continue on.
Allow fields to have more complex logic. String values are normal default values, while a dict defines an advanced field. The dict should at least have a type
key to determine the field type and usually a value
key.
The default value could than also be defined as an advanced field with
{
"fields": {
"FieldName": {
"type": "default-value",
"value": "my default"
}
}
}
This would allow for more complex types of inputs. e.g a file select type.
Installs with boil install -r
can only be updated from the local filesystem, not from GitHub. This is due to the fact, that the template can't be simply pulled for an update.
Similar to repo installs, the update could clone the original repository to a temp folder and only copy the template to update to the local repository.
INI files are more readable and allow for comments to be included in the config file.
INI files can easily be parsed with ConfigParser.
See https://stackoverflow.com/questions/335695/lists-in-configparser for ideas how to use lists in INI files.
-s
surprises any output other than input prompts. Useful in combination with -v
to integrate with other tooling.
Config files and the default local repository are stored in ~\.config\parboil
. On Windows this is not correct.
Where is the best location for these files on each system?
See appdir for a package dealing with this.
To avoid conflicts with different templates, it should be possible to attach profiled values to specific project templates.
E.g. the following config file would profile the Author
key with the value Jonas Neugebauer
. But for the license
template the value will be J. Neugebauer
and for the git
template it will be jneug
.
{
"prefilled": {
"Author": "Jonas Neugebauer",
"license": {
"Author": "J. Neugebauer"
},
"git": {
"Author": "jneug"
}
}
}
Also see #2
The second argument to the install
command could be made optional. The default should use the folder or repository name as a template name.
boil install my/tpl/dir
would than be used with the name dir
:
boil use dir
The template argument could be moved to a -t
option.
boil
should create and populate a click context object that gets passed on to subsequent commands.
The config object is constructed as follows and o duplicate config keys in each step:
-c
option),TPL_DIR
to the -tpldir
option,TPL_DIR
to the BOIL_TPL_DIR
environment var.The flow for using a template with boil use
need to be reworked to allow for dynamic alterations to the template compilation (e.g. adding or removing template files to parse). This would allow for more complex field types (see #5).
All relevant project data should be held in a Project
class that gets through the flow and can be altered at different points. The class should encapsulate everything about the project template. This would also allow for multiple templates to be used at once or "sub-templates" (See #7).
Jinjas syntax might cause problems on some filesystems that don't permit the required special characters.
A possible solution would be to allow renaming via a special field in project.json
.
For example:
{
"filename.txt": {
"type": "rename",
"value": "{{ time '%Y' }}.md"
}
}
For a folder structure like this
root
tpl1
tpl2
tpl3
it should be possible to install all templates in root
into t he local template repository.
For example with
boil install -r root
wirh -r
indicating that root
is a directory of templates.
Afterward the templates tpl1
, tpl2
and tpl3
should be available for use.
Problems:
boil install
currently requires a template name as second argument. Either this argument needs to be optional (also see #1), it is ignored (not recommended) or is used as a subfolder in the local repo (with boil install -r root repo
the templates would ne used with boil use repo/tpl1
).Currently prefilled values can be loaded from config.json. To allow better integration in custom workflows it would be nice to be able to set prefilled values from the command line to allow runs without user interaction.
Ideas:
-v key=value
or -vKey value
).stdin
.This advanced field (see #5) could allow for the selection of a file from a list to be included in the template. The other files from the list would be ignored. The files would be loaded by the Jinja loader and therefore allow for the "includes:" prefix to be used. A license
template could store several license files in the includes
folder and copy the user selected file to the project.
Some options for this field could be:
value
: List of filenames (["file-one.txt", "include:file-two.md", "includes:dir/file-three.py"]
)filename
: Rename the file to this ({% time '%Y' %}_file.txt
)A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.