Skip to main content

Poor man's yo generator.

Project description

Poor man’s yo for quick project generation.

Installation

pip install arst

Creating a new project

Two shortcuts are installed: ars, and arst

ars 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 project-type

This will copy 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 package-type name1=value name2 name3=3

This will generate a package-type project with the following parameters sent into the handlebars template:

{
    "NAME" : "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 particularily useful in conjunction with the positional argument names, making possible scenarios such as:

ars 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.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arst-1.0.21.tar.gz (8.5 kB view details)

Uploaded Source

File details

Details for the file arst-1.0.21.tar.gz.

File metadata

  • Download URL: arst-1.0.21.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.6

File hashes

Hashes for arst-1.0.21.tar.gz
Algorithm Hash digest
SHA256 b75a0fc1ad3c5b8050b05864d1376bbb0372beb5a9291c5c8fd4bc3cb05c85f3
MD5 25326c0b05328797bffb6c2a21257df3
BLAKE2b-256 a077b6aa43410ca6df14195c8f981a81e3e84f1931bf26d85821cdb27aba559a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page