/
Cakefile
34 lines (26 loc) · 993 Bytes
/
Cakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
fs = require 'fs'
sys = require 'sys'
path = require 'path'
$lib = path.join __dirname, 'lib/'
$src = path.join __dirname, 'src/'
{exec, spawn} = require 'child_process'
{puts, print, inspect} = require 'util'
brew = (options, callbacks = {}) ->
coffee = spawn "coffee", options.split(' '), cwd: __dirname
coffee.stdout.setEncoding 'utf8'
coffee.stderr.setEncoding 'utf8'
coffee.stdout.on 'data', callbacks.stdout ? (data) -> puts data.trim()
coffee.stderr.on 'data', callbacks.stderr ? (data) -> puts "stderr: #{data.trim()}"
coffee.on 'exit', callbacks.onexit ? -> null
coffee
task 'build', 'Build...', ->
puts '[Building]'
puts "$lib = #{$lib}"
puts "$src = #{$src}\n"
print "1) Cleaning lib directory... "
exec "rm -rf #{$lib}*", ->
puts "done!"
print "2) Compiling src directory... "
brew '--compile --bare --output lib/ src/', onexit: -> puts "done!"
task 'watch', 'Auto-compile...', ->
brew '--compile --bare --watch --output lib/ src/'