-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fef382
commit 6298207
Showing
4 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{spawn, exec} = require 'child_process' | ||
|
||
task 'build', -> | ||
run 'coffee -c *.coffee test/**/*.coffee' | ||
|
||
# run spawns a bash process, sends it a | ||
# command and hooks its stdout and sterr | ||
# to the current process. We use this in | ||
# our Cakefile. | ||
# | ||
# Parameters are used based on their type: | ||
# - string - is the command | ||
# - object - options passed to spawn | ||
# - array - joined with spaces to form a | ||
# command | ||
# - function - callback to invoke if the | ||
# process completed successfully | ||
# | ||
# Usage: | ||
# run "echo hi", -> | ||
# run "echo bye" | ||
# > hi | ||
# > bye | ||
# | ||
module.exports = run = (args...) -> | ||
for a in args | ||
switch typeof a | ||
when 'string' then command = a | ||
when 'object' | ||
if a instanceof Array then params = a | ||
else options = a | ||
when 'function' then callback = a | ||
|
||
command += ' ' + params.join ' ' if params? | ||
cmd = spawn '/bin/sh', ['-c', command], options | ||
cmd.stdout.on 'data', (data) -> process.stdout.write data | ||
cmd.stderr.on 'data', (data) -> process.stderr.write data | ||
process.on 'SIGHUP', -> cmd.kill() | ||
cmd.on 'exit', (code) -> callback() if callback? and code is 0 | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.