amble 0.1.8

First class, scalable rust project generator with batteries included.
Documentation

amble

Build Status License Docs Latest Version rustc 1.31+

First class, scalable rust project generator with batteries included.

Install | User Docs | Crate Docs | Reference | Contributing

What is amble?

amble is a cli application for generating rust projects with batteries included. By using a workspace and sub-crates, amble scales to any number of crates.

You can think of amble as an extension of cargo new. Cargo's new command provides convenience methods for generating new project structures, the two primary types being a library or a binary project. Below is an example of the directory structure generated by cargo new --lib. (A binary project would only differ in having a main.rs file instead of lib.rs).

project
├─ Cargo.toml
└─ src
   └─ lib.rs

This directory structure doesn't lend itself to building large rust projects that use workspaces.

amble provides a more extensive cli command for generating project directory structures with workspaces. Library "sub-crates" are nested inside the cannonical crates/ directory, while binary crates are nested inside the bin/ directory. A top-level Cargo.toml file defines a workspace including the binaries and libraries as well as shared package metadata and dependencies, minimizing inconsistencies across the sub-crates.

Below is an example waterfall directory structure output for when amble is run with the argument project as the project name.

project
├─ Cargo.toml
├─ bin
│  └─ example
│     ├─ Cargo.toml
│     └─ src
│        └─ main.rs
└─ crates
   └─ common
      ├─ Cargo.toml
      └─ src
         └─ lib.rs

As detailed in Usage below, this output is generated by running amble project --dry-run.

Usage

Install amble using cargo.

cargo install amble

Alternatively, amble can be built from source.

git clone git@github.com:refcell/amble.git && cd amble
cargo build --release

To run amble, it is recommended to first run it in dry mode which will print a waterfall directory structure for the files that would be created when run without dry mode. Simply run amble <project_name> --dry-run, where <project_name> is the name of the project/directory you want to create.

By default, amble uses the current directory for the project name, so it is perfectly acceptable to run amble --dry-run, which will just use . as the project path. Note, amble will exit if it finds cargo artifacts in the directory you chose to execute in.

To run amble out of dry mode, just run amble!

A pre-defined github action ci workflow can be automatically generated by passing in the --with-ci flag to amble. This would generate a directory structure as follows (amble --dry-run --with-ci).

.
├─ Cargo.toml
├─ bin
│  └─ example
│     ├─ Cargo.toml
│     └─ src
│        └─ main.rs
├─ crates
│  └─ common
│     ├─ Cargo.toml
│     └─ src
│        └─ lib.rs
└─ .github
   └─ workflows
      └─ ci.yml

CLI Flags

Below is an inexhaustive list of the main cli flags. These are subject to change and new ones can be added. To view a more up-to-date list, run the amble --help command locally.

First class, scalable rust project generator with batteries included.

Usage: amble [OPTIONS] [PROJECT_DIR]

Arguments:
  [PROJECT_DIR]  The path to the project directory. By default, the current working directory is used. If any rust artifacts are detected in the specified or unspecified directory, an error will be thrown [default: .]

Options:
  -v, --v...               Verbosity level (0-4)
      --dry-run            Dry run mode. If this flag is provided, the cli will not execute commands, printing the directories and files that would be created instead
      --overwrite          Overwrite existing files. If this flag is provided, the cli will overwrite existing files
  -n, --name <NAME>        The project name. This will be used for the binary application name [default: example]
  -w, --with-ci            Add github actions ci workflow
  -c, --ci-yml <CI_YML>    Copy the specified ci workflow file to the project's `.github/workflows/` directory
  -a, --authors <AUTHORS>  Override the project authors
  -h, --help               Print help
  -V, --version            Print version

You can generate this output by running amble --help.

Status

amble is in https://github.com/refcell/amble/labels/beta mode 🎉.

Experimentation is highly encouraged and new issues are welcome.

Contributing

All contributions are welcome!

Troubleshooting & Bug Reports

Please check existing issues for similar bugs or open an issue if no relevant issue already exists.

License

This project is licensed under the MIT License. Free and open-source, forever. All our rust are belong to you.