-
Notifications
You must be signed in to change notification settings - Fork 3
/
tinyrick.rs
124 lines (104 loc) · 2.2 KB
/
tinyrick.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//! Build configuration
extern crate tinyrick;
extern crate tinyrick_extras;
use std::path;
/// Generate documentation
fn doc() {
tinyrick_extras::build();
}
/// Security audit
fn audit() {
tinyrick::exec!("cargo", &["audit"]);
}
/// Run clippy
fn clippy() {
tinyrick_extras::clippy();
}
/// Run rustfmt
fn rustfmt() {
tinyrick_extras::rustfmt();
}
/// Run unmake
fn unmake() {
tinyrick::exec!("unmake", &["makefile"]);
tinyrick::exec!("unmake", &["-n", "makefile"]);
}
/// Lint, and then install artifacts
fn install() {
tinyrick::exec!("cargo", &["install", "--force", "--path", "."]);
}
/// Uninstall artifacts
fn uninstall() {
tinyrick::exec!("cargo", &["uninstall"]);
}
/// Validate documentation and run linters
fn lint() {
tinyrick::deps(install);
tinyrick::deps(doc);
tinyrick::deps(clippy);
tinyrick::deps(rustfmt);
tinyrick::deps(unmake);
}
/// Run tests
fn test() {
tinyrick_extras::unit_test();
}
/// Build: Doc, lint, test, and compile
fn build() {
tinyrick::deps(lint);
tinyrick::deps(test);
tinyrick_extras::build();
}
/// banner generates artifact labels.
fn banner() -> String {
format!("{}-{}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"))
}
/// archive bundles executables.
fn archive() {
tinyrick_extras::archive(
path::Path::new(".crit").join("bin").display().to_string(),
banner(),
);
}
/// Prepare cross-platform release media.
fn port() {
tinyrick_extras::crit(vec!["-b".to_string(), banner()]);
tinyrick::deps(archive);
}
/// Publish to crate repository
fn publish() {
tinyrick_extras::publish();
}
/// Clean ports
fn clean_ports() {
assert!(tinyrick::exec_mut!("crit", &["-c"])
.status()
.unwrap()
.success());
}
/// Clean workspaces
fn clean() {
tinyrick_extras::clean_cargo();
tinyrick::deps(clean_ports);
}
/// CLI entrypoint
fn main() {
tinyrick::phony!(clean);
tinyrick::wubba_lubba_dub_dub!(
build;
doc,
install,
uninstall,
audit,
clippy,
rustfmt,
unmake,
lint,
test,
archive,
port,
publish,
clean_ports,
clean
);
}