snowflake/proxy/Cakefile
2016-02-04 14:57:12 -08:00

55 lines
1.3 KiB
CoffeeScript

fs = require 'fs'
{spawn, exec} = require 'child_process'
# All coffeescript files required.
FILES = [
'shims.coffee'
'util.coffee'
'proxypair.coffee'
'websocket.coffee'
'broker.coffee'
'ui.coffee'
'snowflake.coffee'
]
FILES_SPEC = [
'spec.coffee'
]
FILES_ALL = FILES.concat FILES_SPEC
OUTFILE = 'build/snowflake.coffee'
STATIC = 'static'
concatCoffeeFiles = -> exec 'cat ' + FILES.join(' ') + ' | cat > ' + OUTFILE
copyStaticFiles = -> exec 'cp ' + STATIC + '/* build/'
compileCoffee = ->
exec 'coffee -o build -b -c build/snowflake.coffee', (err, stdout, stderr) ->
throw err if err
task 'test', 'snowflake unit tests', ->
exec 'jasmine init >&-'
jasmineFiles = FILES.concat FILES_SPEC
outFile = 'spec/snowflake.bundle.coffee'
exec 'cat ' + jasmineFiles.join(' ') + ' | cat > ' + outFile
exec 'coffee -o spec -cb ' + outFile
spawn 'jasmine', ['spec/snowflake.bundle.js'], {
stdio: 'inherit'
}
task 'build', 'build the snowflake proxy', ->
exec 'mkdir -p build'
concatCoffeeFiles()
copyStaticFiles()
compileCoffee()
console.log 'Snowflake prepared.'
task 'lint', 'ensure idiomatic coffeescript', ->
spawn 'coffeelint', FILES_ALL, {
file: 'coffeelint.json'
stdio: 'inherit'
}
task 'clean', 'remove all built files', ->
exec 'rm -r build'
exec 'rm -r spec'
exec 'rm -r test/snowflake.bundle.coffee'