This repository has been archived by the owner on Mar 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathCakefile
62 lines (50 loc) · 1.75 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
{spawn, exec} = require 'child_process'
fs = require 'fs'
glob = require 'glob'
which = require 'which'
async = require 'async'
process.title = 'cake ' + process.argv[2..].join ' '
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"
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', ->
process.env.NODE_ENV = 'testing'
nodemon = spawn 'nodemon', ['--ignore', './test', './server/code/index.coffee']
nodemon.stdout.pipe process.stdout
nodemon.stderr.pipe process.stderr
Selenium = ->
glob "selenium-server-standalone-2.*.jar", null, (err, files) ->
jarfile = files[files.length-1]
se = spawn 'java', ['-jar', jarfile,
'-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