Created
February 12, 2012 17:11
-
-
Save fukayatsu/1809676 to your computer and use it in GitHub Desktop.
srcディレクトリに変更があったらビルドして、成功したらテストする
This file contains hidden or 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
fs = require 'fs' | |
{print} = require 'util' | |
{spawn} = require 'child_process' | |
build = (callback) -> | |
coffee = spawn 'coffee', ['-c', '-o', 'lib', 'src'] | |
coffee.stderr.on 'data', (data) -> | |
process.stderr.write data.toString() | |
coffee.stdout.on 'data', (data) -> | |
print data.toString() | |
coffee.on 'exit', (code) -> | |
callback?() if code is 0 | |
task 'build', 'Build lib/ from src/', -> | |
build() | |
task 'watch', 'Watch src/ for changes', -> | |
coffee = spawn 'coffee', ['-w', '-c', '-o', 'lib', 'src'] | |
#build failed | |
coffee.stderr.on 'data', (data) -> | |
process.stderr.write data.toString() | |
#build SUCCESS | |
coffee.stdout.on 'data', (data) -> | |
print data.toString() | |
#testing | |
jasmine = spawn 'jasmine-node', ['--coffee', 'spec'] | |
jasmine.stderr.on 'data', (data) -> | |
process.stderr.write data.toString() | |
jasmine.stdout.on 'data', (data) -> | |
print data.toString() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment