Poor man's yo generator.
Project description
Quick project generation.
Installation
pip install arst
Creating a new project
Two shortcuts are installed: ars, and arst. These keys are consecutive if you’re using a Colemak keyboard layout.
ars generate project-type
or if a project is already created, and we want to reaply the templates, but with a tree diff for all the conflicting files. This will use the program specified in the ARS_DIFF_TOOL or in case the variable is not defined vimdiff:
arst generate project-type
This copies all the resources from the ~/.projects/project-type into the current folder. Files that have the .hbs extension will be used as templates, and copied with the extension removed.
The project type is sent as NAME into the handlebars templates.
Thus if you have a structure such as:
.projects/project-type
├── package.json.hbs
└── static
└── index.html
After the ars project-type command you will have in your current folder:
.
├── package.json
└── static
└── index.html
The package.json file will be parsed as expected.
If the file name from the project ends with .KEEP on subsequent calls from the same folder, it won’t be overwritten.
Parameters
Parameters can be also passed to the templates themselves. In case a parameter does not have a value, true will be set instead.
ars generate package-type name1=value name2 name3=3
This will generate a package-type project with the following parameters sent into the handlebars template:
{
"templates" : ["package-type"],
"name1" : "value",
"name2" : true,
"name3" : "3",
"arg0": "name1",
"arg1": "name2",
"arg2": "name3"
}
Since the templating also happens to the file names themselves, so a file named {{name1}}.txt will be installed as value.txt. This is particularly useful in conjunction with the positional argument names, making possible scenarios such as:
ars generate new-model User
If in our project we have: {{arg0}}.html.hbs and {{arg0}}.js.hbs, they will be expanded as: User.html and User.js.
Extra Commands
Command |
Description |
---|---|
diff |
Diff a file against the template |
edit |
Edit a file from the project |
generate |
Generate or update the project sources |
lls |
List a folder from the project |
ls |
List the project folder |
push |
Push a file into the template |
pwd |
Display the project location |
tree |
Display the project tree |
version |
Print the current application version |
Table: Extra Commands
Configuration
If you store your project files into a different folder, you can use the ARS_PROJECTS_FOLDER environment variable to point to the absolute path of it.
Implicitly when creating a new project, an .ars file will be created with the current settings, so if the project is changed, you can reaplly your project template. If you want not to have this file created, just add a .noars file in the project template.
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 arst-1.3.0.tar.gz
.
File metadata
- Download URL: arst-1.3.0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dba87226b94ac74cd1aa74c0bd6eefdad947def0c09a1034d3e2c33c5f721cb |
|
MD5 | 0451db628400ab1bd5d91cedd7fe1e41 |
|
BLAKE2b-256 | 8a04c24bb3d9e2fac504905a42cda12fc8d252e043518d57fc2dea82e047e2bd |