Crates.io | quickproj |
lib.rs | quickproj |
version | 0.3.0 |
source | src |
created_at | 2019-10-30 10:05:05.220908 |
updated_at | 2019-11-25 08:29:58.552513 |
description | Flexible project creation for minimalists |
homepage | https://github.com/Relrin/quickproj |
repository | https://github.com/Relrin/quickproj |
max_upload_size | |
id | 176881 |
size | 515,571 |
Flexible project creation for minimalists
Download executable/binary file in according to the used operation system from the releases page.
Link executable/binary file to operation system, so you could invoke quickproj
everywhere:
Linux / Mac OS
Move the binary file to the /usr/local/bin
directory and restart the terminal
mv ~/Downloads/quickproj /usr/local/bin
Windows
System
menu item.Advanced System Settings
button.Environment Variables
button.PATH
variable and click in the Edit
button.New
button.quickproj
executable.OK
button a couple of times for applying changes.After it you can call the quickproj
command from any folder. For more information about acceptable arguments and options for each command, call any desired command with the --help
option.
Q: What is the purpose of this tool?
A: I made it for easier developing new projects from the scratch. By defining the used templates you have more granular control over your needs and how to prepare the new project.
Q: Is it possible to run commands in the multi-threaded mode?
A: No, it isn't possible to run the command in multi-threaded at the moment. Although the existing code base can be easily changed for those things, but for prevent "killing" your hard drive with massive I/O operations, I've decided to left it simple as much as possible.
Each installed template has to have configuration file (named as the config.json
) in the root template folder and files that needs to copy or generate for the new project.
As the example we will take and modify one of the existing templates for the quickproj
(original file) application:
{
"files":{
"sources": [
{ "from": "sources", "to": "." }
],
"generated": [
"configs/{{ terraform_sage_environment }}/variables.tfvars"
],
"directories": [
"configs/{{ terraform_sage_environment }}"
],
"templates": {
"variables.tfvars": "templates/variables.tfvars"
}
},
"variables": {
"terraform_sage_environment": [
"dev",
"production",
"staging"
],
},
"scripts": {
"after_init": [
"ls -al"
]
},
"storage": {
"variables": {
"service_name": "service"
}
}
}
The configuration file must be saved in the root directory of the template with the config.json
file name. Otherwise, the quickproj
application will ignore the user's template.
The main section of the configuration file of the template. It stores the information about what files and folders need to create, copy or generate.
sources
This section stores paths to the used folders for copying files. Each record must have the following keys:
from
key means the relative path to the template folder from which files need to copy to the target directory.to
key means the relative path in the target folder in which files have to be copied from the source directory.generated
Defines relative paths to templates needs to generated in the target folder. Each path can be specified as the static (=hardcoded) or dynamic (=with the usage of config variables) paths to target files. For using the templates in this section, the user must to specify the desired template name in the end of the path (the same key value as it was defined in templates
section).
In the example above, we have specified a dynamic path, so that it will generate three files with the following paths based on the variables.tfvars
template:
configs/dev/variables.tfvars
configs/production/variables.tfvars
configs/staging/variables.tfvars
directories
Defines the directories that needs to be generated before copying files. In the example, the "configs/{{ terraform_sage_environment }}"
values means that we're going to create three different directories. The values for it will be extracted from the terraform_sage_environment
variable, specified in the variables
section.
In our example, the application will create three folders, based on the dynamic paths and variables from the variables
section:
configs/dev/
configs/production/
configs/staging/
templates
Defines the list of records that have to be used for the project generation process, where:
generated
sectionOptional section which stores all variables that can be used during the project generation and can be overridden by the user if was specified the --override-all
or the --override
options in CLI.
Each variable, specified in this section has to met the following requirements:
string
type.string
or as the array of strings
types.Key / values pairs that won't met the requirements will be ignored and not used during the project generation.
During the overriding stage (when the CLI will ask you to specify the value to override), you can specify any correct values for the certain types:
string
type.,
for the array of strings
type.Hitting the Enter
key or setting the empty string for the certain key will lead to using the default value, specified in the configuration.
Optional section that describes a list of commands/scripts that could be executed during the template installation process.
after_init
Required to be defined as the array of strings, where each string represented as the certain command needs to be executed after the template installation process.
For example from the example on top, the application will execute the ls -al
command to output the list of files in the current directory.
Optional section which is using as the storage for the template data, without giving an access to endusers to override them.
variables
Optional. Defines template variables as the key-value pairs with the a reference support for accessing the main variables section.
Each key-value pair has to met the following requirements:
string
type.string
or as the array of strings
types.variables
section must be specified as the string with the Vars.
prefix. For example: {{ Vars.my_variable }}
.The quickproj is published under BSD license. For more details read the LICENSE file.