Rust blueprint project


#1

I noticed I have to copy-paste several files from old projects every time I start new Rust project,
so I decided to automate the process.

Hence, I created rust-bluebprint.

This is a set of config files for different moving parts of my usual Rust project layout, including:

  • Cargo.toml manifest,
  • build.rs stub,
  • Licenses,
  • rustfmt.toml (with my preferences),
  • .travis.yml (set up for travis-cargo support).

It also includes a shell script (init) which sets all things up.

This solution may be somewhat ad-hoc to my needs and workflows, but I tried to make things general enough
(for a prototype) to make it usable.

The workflow is the following:

  1. create repository in Github (let’s name it “my-new-rust-project”),
  2. clone rust-blueprint to a new directory: git clone https://github.com/kstep/rust-blueprint my-new-rust-project,
  3. go to this directory: cd my-new-rust-project,
  4. run ./init (or GH_TOKEN=<<GITHUB-SECRET-TOKEN>> ./init if you have travis cli installed and want to build and push docs to Travis).

That’s all!

Now you have minimal Cargo.toml setup, .travis.yml configured, licenses with updated copyright notice, and git remote updated, with single “initial commit” in the local git repository.

You are free to commit on and/or push to you github repo.


#2

you could probably turn this into a cargo subcommand, so users could install it through cargo install blue, and then call cargo blue name


#3

Yes! I’m very excited about this. I think being able to spit out project templates is going to be an important part of the Rust platform eventually. e.g. give me a template to set up an Android application, or a rump kernel that runs on AWS.

Keeping an eye on this project.


#4

Cool blueprint! :+1:

I’m wondering if there can be a binary flavoured blueprint with adapted scripts from https://github.com/japaric/rust-everywhere ?

Perhaps something like a binary/bin branch so as to keep master lightweight.

If you’re interested in this change, I may PR :smiley:


#5

Sure, that would be really cool!


#6

I guess I should refactor the project to support multiple blueprints, so one can run cargo blue --template aws-bin my-program to create new project from a blueprint.