Last active
January 2, 2016 01:29
-
-
Save Raynos/8230415 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var task = require("monk") | |
var shell = require("monk-shell") | |
var buildTask = task("build", function (rule) { | |
rule("hello.c", "hello.o", | |
shell("gcc -Wall -c %i -o %o")) | |
rule("square.c", "square.o", | |
shell("gcc -Wall -c %i -o %o")) | |
rule(["hello.o", "square.o"], "hello", | |
shell("gcc %i -o %o")) | |
}) | |
module.exports = buildTask | |
if (require.main === module) { | |
buildTask() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var exec = require("child_process").exec | |
module.exports = shell | |
function shell(command) { | |
return function (input, output, callback) { | |
var cmd = command.replace("%i", input).replace("%o", output) | |
exec(cmd, function (err, stdout, stderr) { | |
callback(err) | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment