.---. ^
o{__ω__ o{ ^0^ -Let me out!
~~ ( // *|* \xx\) xx`|'
= = xxxx&x ' `
```console $ cd example
$ tinyrick running 1 test test smoketest ... ok ```
I'm tinyrick (TINYRICK!) and I build Rust projects. With tinyrick, you configure your build in the same normal Rust code as the rest of your project. Or keep picking your nose with make, it's up to you.
Look at my pants! tinyrick! You think my pants are one size fits all? No, of course not! So get the pants that fit you. Get a tiny rick.rs
that fits your workflow. Task dependency trees, get em while they're hot! Segfaults, get em while they're not. Smarter, butter, faster, stranger.
Don't shell out, lib out. Your build is more portable that way. Holy Maven, put that foot on some ice! Who knows, maybe fair market feet prices will go up next year! tinyricktinyricktinyrick. If you look closely, that last period is actually a micro rick rendered in ASCII; even tinier tinyrick!
https://crates.io/crates/tinyrick
https://docs.rs/tinyrick/
Write some tasks in a rick.rs
build configuration script at the top-level directory of your Rust project:
```rust fn banner() { println!("{} {}", env!("CARGOPKGNAME"), env!("CARGOPKGVERSION")); }
fn test() { tinyrick::exec!("cargo", &["test"]); }
fn build() { tinyrick::deps(test); tinyrick::exec!("cargo", &["build", "--release"]); }
fn publish() { tinyrick::exec!("cargo", &["publish"]); }
fn clean() { tinyrick::exec!("cargo", &["clean"]); }
fn main() { tinyrick::phony!(clean); tinyrick::wubbalubbadub_dub!(build; banner, test, publish, clean); } ```
Now, wire up the tinyrick command line interface by configuring your top-level Cargo.toml
:
```toml [package] name = "derpmobile" description = "hyperadvanced derpmobiles" version = "3.1.4"
[dependencies] tinyrick = { version = "0.0.7", optional = true }
[features] letmeout = ["tinyrick"]
[[bin]] name = "rick" path = "rick.rs" required-features = ["letmeout"] ```
Launch a terminal session in your project directory, and run tinyrick
. Watch how he behaves... I hope tinyrick is practicing good manners :P
What happens when you run:
tinyrick banner
?tinyrick test
?tinyrick publish
?tinyrick clean
?tinyrick build
?VERBOSE=1 tinyrick build
?I bet the freakin' moon explodes if you run VERBOSE=1 tinyrick build build build
! (Hold onto your pants~)
Where are my pants? Let's break down the code so far:
fn name() { ... }
declares a task named name
.deps(requirement)
caches a dependency on task requirement
.exec!(...)
spawns raw shell command processes.VERBOSE=1
enables command string emission during processing.phony!(...)
disables dependency caching for some tasks.wubba_lubba_dub_dub!(default; ...)
exposes a default
task and some other tasks to the tinyrick
command line.letmeout
is a feature gate, so that neither the tinyrick
package, nor the mini rick
binary escape with your Rust package when you tinyrick publish
.Just because the tinyrick library offers several supremely convenient macros for executing shell commands doesn't mean that you should always shell out. No way, man!
Whenever possible, use regular Rust code, as in the banner()
example. There's like a ba-jillion crates of prewritten Rust code, so you might as well use it!
For more details on developing tinyrick itself, see DEVELOPMENT.md.