Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 22fa348968
Fetching contributors…

Cannot retrieve contributors at this time

70 lines (56 sloc) 2.32 kb
fs = require("fs")
path = require("path")
{spawn, exec} = require("child_process")
stdout = process.stdout
# Use executables installed with npm bundle.
process.env["PATH"] = "node_modules/.bin:#{process.env["PATH"]}"
# ANSI Terminal Colors.
bold = "\033[0;1m"
red = "\033[0;31m"
green = "\033[0;32m"
reset = "\033[0m"
# Log a message with a color.
log = (message, color, explanation) ->
console.log color + message + reset + ' ' + (explanation or '')
# Handle error and kill the process.
onerror = (err)->
if err
process.stdout.write "#{red}#{err.stack}#{reset}\n"
process.exit -1
# Setup development dependencies, not part of runtime dependencies.
task "setup", "Install development dependencies", ->
fs.readFile "package.json", "utf8", (err, package)->
log "Need runtime dependencies, installing into node_modules ...", green
exec "npm bundle", onerror
log "Need development dependencies, installing ...", green
for name, version of JSON.parse(package).devDependencies
log "Installing #{name} #{version}", green
exec "npm bundle install \"#{name}@#{version}\"", onerror
task "install", "Install Beaconpush in your local repository", ->
build (err)->
onerror err
log "Installing Beaconpush ...", green
exec "npm install", (err, stdout, stderr)->
process.stdout.write stderr
onerror err
build = (callback)->
log "Compiling CoffeeScript to JavaScript ...", green
exec "rm -rf lib && coffee -c -l -b -o lib src", (err, stdout)->
callback err
task "build", "Compile CoffeeScript to JavaScript", -> build onerror
task "watch", "Continously compile CoffeeScript to JavaScript", ->
cmd = spawn("coffee", ["-cw", "-o", "lib", "src"])
cmd.stdout.on "data", (data)-> process.stdout.write green + data + reset
cmd.on "error", onerror
clean = (callback)->
exec "rm -rf html lib man7", callback
task "clean", "Remove temporary files and such", -> clean onerror
runTests = (callback)->
log "Running test suite ...", green
exec "vows --spec spec/*-spec.coffee", (err, stdout, stderr)->
process.stdout.write stdout
process.binding('stdio').writeError stderr
callback err if callback
task "test", "Run all tests", ->
runTests (err)->
process.stdout.on "drain", -> process.exit -1 if err
Jump to Line
Something went wrong with that request. Please try again.