All Projects → iomentum → cargo-scaffold

iomentum / cargo-scaffold

Licence: MIT license
cargo scaffold lets you scaffold and generate projects described in a simple TOML file

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to cargo-scaffold

readme-generator
Generate a readme from a template and package.json data. If you need something more comprehensive, I recommend using Verb.
Stars: ✭ 18 (-47.06%)
Mutual labels:  generate, templates
semantic-ui-forest
[Archived] Source code for official semantic-ui-forest website.
Stars: ✭ 49 (+44.12%)
Mutual labels:  templates
flutter getx template
🍻🍀 This is source base for getx flutter. Optimize by lambiengcode
Stars: ✭ 43 (+26.47%)
Mutual labels:  templates
simplest view
SimplestView gives us the power to split Rails Views out from our Templates
Stars: ✭ 41 (+20.59%)
Mutual labels:  templates
django-apptemplates
Django template loader that allows you to load and override a template from a specific Django application.
Stars: ✭ 43 (+26.47%)
Mutual labels:  templates
browserslist-generator
A library that makes generating and validating Browserslists a breeze!
Stars: ✭ 77 (+126.47%)
Mutual labels:  generate
ConvNet-OOP
ConvNet Implementation: An Object Oriented Approach using Keras API.
Stars: ✭ 20 (-41.18%)
Mutual labels:  templates
SPX-GC
SPX is a graphics control client for live video productions and live streams using CasparCG, OBS, vMix, or similar software.
Stars: ✭ 178 (+423.53%)
Mutual labels:  templates
auto-commit-msg
A VS Code extension to generate a smart commit message based on file changes
Stars: ✭ 61 (+79.41%)
Mutual labels:  generate
test-data-generation
Test Data Generation
Stars: ✭ 35 (+2.94%)
Mutual labels:  generate
okty
The simplest application to create and customize your docker projects
Stars: ✭ 48 (+41.18%)
Mutual labels:  generate
zsh-launchpad
🚀 Simple, educational dotfiles template to get started with Zsh and learn about its features
Stars: ✭ 141 (+314.71%)
Mutual labels:  templates
Azia-Admin-Bootstrap-Template
Free Bootstrap 4 Admin template
Stars: ✭ 73 (+114.71%)
Mutual labels:  templates
global-typelist
How to build and maintain a "global" type-list
Stars: ✭ 22 (-35.29%)
Mutual labels:  templates
gas-vue-typescript
Template for Google Apps Script macros and its front-end webapp setup with TypeScript, Vue.js, Vuetify.
Stars: ✭ 40 (+17.65%)
Mutual labels:  templates
hypertag
HTML templates with Python-like concise syntax, code reuse & modularity. The Pythonic way to web templating.
Stars: ✭ 27 (-20.59%)
Mutual labels:  templates
drupal-template-helper
Debug Drupal 8 templates in Chrome Devtools. drupal-template-helper is a chrome extension for Drupal that lists all available templates and the preprocess hooks to use to customize your templates.
Stars: ✭ 115 (+238.24%)
Mutual labels:  templates
manifest-design
vue开发的商品标签设计插件 && 系统,功能包含:设计,预览,打印
Stars: ✭ 133 (+291.18%)
Mutual labels:  templates
contextual
🌈 Generate your Ecto contexts using this macro and eliminate boilerplate
Stars: ✭ 18 (-47.06%)
Mutual labels:  generate
django-template
A battle-tested Django 2.1 project template with configurations for AWS, Heroku, App Engine, and Docker.
Stars: ✭ 64 (+88.24%)
Mutual labels:  templates

Cargo-scaffold

cargo-scaffold is a flexible and easy-to-use developper tool to let you scaffold a project. It's fully configurable without writing any line of code. It generates any kind of projects with a developer friendly CLI.

Features

  • Scaffold a project in seconds
  • Declarative
  • User interactions automatically generated
  • Not only for Rust crate/project. It's completely language agnostic

Installation

cargo install cargo-scaffold

Usage

You can scaffold your project from any cargo-template scaffold located locally in a directory or in a git repository

# Locally
cargo scaffold your_template_dir

# From git repository
cargo scaffold https://github.com/username/template.git

# From git repository based on a specific commit
cargo scaffold https://github.com/username/template.git -t deed14dcbf17ba87f6659ea05755cf94cb1464ab

Here are the available options for cargo scaffold:

USAGE:
    cargo-scaffold scaffold [FLAGS] [OPTIONS] <template>

FLAGS:
    -a, --append        Append files in the target directory, create directory with the project name if it doesn't
                        already exist but doesn't overwrite existing file (use force for that kind of usage)
    -f, --force         Override target directory if it exists
    -h, --help          Prints help information
    -p, --passphrase    Specify if your SSH key is protected by a passphrase
    -V, --version       Prints version information

OPTIONS:
    -t, --git_ref <git_ref>
            Full commit hash or tag from which the template is cloned (i.e.: "deed14dcbf17ba87f6659ea05755cf94cb1464ab"
            or "v0.5.0")
    -n, --name <name>
            Specify the name of your generated project (and so skip the prompt asking for it)
        --param <parameters>...                  Supply parameters via the command line in <name>=<value> format
    -k, --private_key_path <private-key-path>
            Specify if your private SSH key is located in another location than $HOME/.ssh/id_rsa

    -r, --path <repository_template_path>
            Specify your template location in the repository if it's not located at the root of your repository

    -d, --target_directory <target_directory>    Specify the target directory

ARGS:
    <template>    Specify your template location

Write your own template

To let you scaffold and generate different projects the only mandatory part is to have a .scaffold.toml file at the root of the template directory. This file is used to document and add user interactions for your template. In your template's directory each files and directories will be copy/pasted to your generated project but updated using Handlebars templating.

Template description

Here is an example of .scaffold.toml file:

# Basic template informations
[template]
name = "test"
author = "Benjamin Coenen <[email protected]>"
version = "0.1.0"

# Exclude paths you do not want copy/pasted in the generated project
exclude = [
    "./target"
]

# Notes to display at the end of the generation
notes = """
Have fun using this template called {{name}} ! Here is the description: {{description}}
"""

[hooks]
# Commands to be executed before scaffolding, from within the generated project
pre = [
    "bash -c some_pre_script.sh"
]
# Commands to be executed after scaffolding, from within the generated project
post = [
    "cargo vendor",
    "bash -c some_post_script.sh"
]

# Parameters are basically all the variables needed to generate your template using templating.
# It will be displayed as prompt to interact with user (thanks to the message subfield).
# All the parameters will be available in your templates as variables (example: `{{description}}`).
[parameters]
    # [parameters.name] is already reserved
    [parameters.feature]
    type = "string"
    message = "What is the name of your feature ?"
    required = true

    [parameters.gender]
    type = "select"
    message = "Which kind of API do you want to scaffold ?"
    values = ["REST", "graphql"]

    [parameters.dependencies]
    type = "multiselect"
    message = "Which dependencies do you want to use ?"
    values = ["serde", "anyhow", "regex", "rand", "tokio"]

    [parameters.description]
    type = "string"
    message = "What is the description of your feature ?"
    default = "Here is my default description"

    [parameters.show_description]
    type = "boolean"
    message = "Do you want to display the description ?"

    [parameters.limit]
    type = "integer"
    message = "What is the limit ?"

Here is the list of different types you can use for your parameter: string, integer, float, boolean, select, multiselect.

Templating

In any files inside your template's directory you can use Handlebars templating. Please refer to that documentation for all the syntax about templating. If you're looking for custom helpers in Handlerbars you can check the documentation here. Here is a basic example if you want to display the parameter named description and if the boolean parameter show_description is set to true as described in the previous section.

{{#if show_description}} {{description}} {{/if}}
{{#forRange 5}}
Repeat this line 5 times with the current {{@index}}{{/forRange}}

You can also put templating in path for directory or filename into your template (example: a file called {{name}}.rs would be generated with the right name).

Credits

Thanks @Arlune for this awesome logo and all reviewers.

Alternatives

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].