This repository was archived by the owner on Apr 9, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathCakefile
More file actions
44 lines (38 loc) · 1.44 KB
/
Cakefile
File metadata and controls
44 lines (38 loc) · 1.44 KB
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
fs = require 'fs'
{exec} = require 'child_process'
log = require('printit')
prefix: 'cake'
walk = (dir, excludeElements = []) ->
fileList = []
list = fs.readdirSync dir
if list
for file in list
if file and file not in excludeElements
filename = "#{dir}/#{file}"
stat = fs.statSync filename
if stat and stat.isDirectory()
fileList = fileList.concat walk filename, excludeElements
else if filename.substr(-6) is "coffee"
fileList.push filename
return fileList
task "build", "Compile coffee files to JS", ->
log.info "Compile coffee files to JS..."
command = "coffee --compile --output lib/ src/ "
exec command, (err, stdout, stderr) ->
if err
log.error "Running coffee-script compiler caught exception:\n#{err}"
process.exit 1
else
log.info "Compilation succeeded."
process.exit 0
task "lint", "Run coffeelint on source files", ->
lintFiles = walk '.', ['node_modules', 'tests']
testCommand = "coffeelint -v"
exec testCommand, (err, stdout, stderr) ->
if err? or stderr?
command = "./node_modules/coffeelint/bin/coffeelint"
else
command = "coffeelint"
command += " -f coffeelint.json -r " + lintFiles.join " "
exec command, (err, stdout, stderr) ->
log.info stdout