forked from noflo/noflo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCakefile
More file actions
53 lines (45 loc) · 1.5 KB
/
Cakefile
File metadata and controls
53 lines (45 loc) · 1.5 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
45
46
47
48
49
50
51
52
53
{exec} = require 'child_process'
fs = require 'fs'
{series} = require 'async'
sh = (command) -> (k) ->
console.log "Executing #{command}"
exec command, (err, sout, serr) ->
console.log err if err
console.log sout if sout
console.log serr if serr
do k
checkSubDir = (path) ->
fs.stat "#{__dirname}/src/#{path}", (err, stat) ->
buildDir "#{path}" if stat.isDirectory()
buildDir = (path) ->
realPath = "#{__dirname}/src/#{path}"
targetPath = "#{__dirname}/#{path}"
fs.readdir realPath, (err, files) ->
hasCoffee = false
for file in files
if file.indexOf('.coffee') isnt -1
hasCoffee = true
continue
checkSubDir "#{path}/#{file}"
return unless hasCoffee
console.log "Compiling CoffeeScript from 'src/#{path}' to '#{path}"
exec "coffee -c -o #{targetPath} #{realPath}", (err, stdout, stderr) ->
console.log stderr if stderr
task 'build', 'transpile CoffeeScript sources to JavaScript', ->
buildDir "lib"
buildDir "components"
buildDir "bin"
task 'test', 'run the unit tests', ->
sh('npm test') ->
task 'doc', 'generate documentation for *.coffee files', ->
sh('./node_modules/docco-husky/bin/generate src') ->
task 'docpub', 'publish documentation into GitHub pages', ->
series [
(sh "./node_modules/docco-husky/bin/generate src")
(sh "mv docs docs_tmp")
(sh "git checkout gh-pages")
(sh "cp -R docs_tmp/* docs/")
(sh "git add docs/*")
(sh "git commit -m 'Documentation update'")
(sh "git checkout master")
]