-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
chompfile.toml
41 lines (35 loc) · 1.01 KB
/
chompfile.toml
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
version = 0.1
default-task = 'build'
[[task]]
name = 'build'
deps = ['src/**/*.rs']
run = 'cargo build'
[[task]]
name = 'build:release'
deps = ['src/**/*.rs']
run = 'cargo build --release --locked'
[[task]]
name = 'test'
dep = 'build'
cwd = 'test'
run = '../target/debug/chomp test'
[[task]]
name = 'install'
serial = true
dep = 'build'
run = 'cp ./target/[dD]ebug/chomp* ~/bin/'
[[task]]
name = 'inline-version'
deps = ['Cargo.toml']
targets = ['src/main.rs', 'node-chomp/package.json']
engine = 'node'
run = '''
import { readFileSync, writeFileSync } from 'fs';
const toml = readFileSync('Cargo.toml', 'utf8');
const [, version] = toml.match(/version\s*=\s*\"(\d+\.\d+\.\d+)\"/);
const main = readFileSync('src/main.rs', 'utf8');
writeFileSync('src/main.rs', main.replace(/let version = "\d+.\d+.\d+/g, `let version = "${version}`));
const pjson = JSON.parse(readFileSync('node-chomp/package.json', 'utf8'));
pjson.version = version;
writeFileSync('node-chomp/package.json', JSON.stringify(pjson, null, 2));
'''