forked from sensiblecodeio/custard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCakefile
62 lines (50 loc) · 1.77 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
fs = require 'fs'
which = require 'which'
{spawn, exec} = require 'child_process'
async = require 'async'
pkg = JSON.parse fs.readFileSync('./package.json')
testCmd = pkg.scripts.test
startCmd = pkg.scripts.start
log = (message, explanation) ->
console.log "#{message} #{explanation or ''}"
compile = (outputDir, inputDir, watch, callback) ->
options = ['-c','-b']
options.push('-w') if watch is true
options = options.concat ['-o', outputDir, inputDir]
cmd = which.sync 'coffee'
coffee = spawn cmd, options
coffee.stdout.pipe process.stdout
coffee.stderr.pipe process.stderr
coffee.on 'exit', (status) -> callback?()
coffee
# Compiles app.coffee and src directory to the app directory
build = (watch, callback) ->
async.parallel [
(cb) -> compile('server/js', 'server/code', watch, cb),
(cb) -> compile('shared/js', 'shared/code', watch, cb)
]
task 'clean', ->
console.log "Cleaning database and inserting fixtures"
cp = require 'child_process'
cp.exec 'test/cleaner.coffee'
task 'build', ->
build false, ->
process.exit 0
task 'test', 'Run unit tests', ->
build -> test process.argv[3..]
task 'dev', 'start dev env', ->
log 'Watching coffee files'
supervisor = spawn 'node', ['./node_modules/supervisor/lib/cli-wrapper.js','-w','server/js,server/template,shared/js', '-e', 'js|html', 'server']
supervisor.stdout.pipe process.stdout
supervisor.stderr.pipe process.stderr
log 'Watching js files and running server'
build true, ->
# watch_js
Selenium = ->
se = spawn 'java', ['-jar', 'selenium-server-standalone-2.29.0.jar',
'-Dwebdriver.chrome.driver=chromedriver']
se.stdout.pipe process.stdout
se.stderr.pipe process.stderr
log 'Selenium started'
task 'se', 'start selenium', Selenium
task 'Se', 'start Selenium', Selenium