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)); '''