-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cakefile
28 lines (24 loc) · 1.27 KB
/
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
{exec} = require 'child_process'
fs = require 'fs'
file = require 'file'
logger = (callback) ->
return (err, stdout, stderr) ->
console.log stdout + stderr
throw err if err
callback?()
task 'build', 'Build project from src/*.coffee to release/*.js', ->
exec 'coffee --compile --output release/ src/', (err, stdout, stderr) ->
throw err if err
console.log stdout + stderr
task 'minify', 'Minify the resulting application file after build', ->
exec './node_modules/uglify-js/bin/uglifyjs --reserved-names "require,define,_" --output release/accessorize.min.js release/accessorize.js', logger()
task 'test', 'Run the specs', ->
exec 'node_modules/sinon/build', logger ->
exec 'node_modules/coffee-script/bin/coffee --compile spec', logger ->
exec 'node_modules/coffee-script/bin/coffee --compile src', logger ->
specs = []
file.walkSync 'spec', (dirPath, dirs, files) ->
files = (dirPath + "/" + file for file in files when file.match /.*spec\.js/) if files?
specs = specs.concat files
fs.writeFileSync 'spec/spec_list.js', "define([], {count: #{specs.length}, specs : #{JSON.stringify specs}})"
exec './node_modules/mocha/bin/mocha ./spec/initialize.coffee --colors --growl --reporter dot', logger()