forked from gardenofwine/obudget2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cakefile
35 lines (35 loc) · 1.21 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
fs = require 'fs'
{exec} = require 'child_process'
appFiles = [
'controllers/ControllerClass'
'controllers/PieChartController'
'controllers/ColumnChartController'
'controllers/SearchController'
'controllers/SingleYearTableController'
'controllers/MultiYearTableController'
'controllers/VizController'
'models/Model'
'utils/mustacheTemplates'
'utils/utils'
'utils/i18n'
'views/ColumnChartView'
'views/PieChartView'
'views/TableView'
'app'
]
task 'build', 'Build single application file from source files', ->
appContents = new Array remaining = appFiles.length
for file, index in appFiles then do (file, index) ->
fs.readFile "src/coffee/#{file}.coffee", 'utf8', (err, fileContents) ->
throw err if err
appContents[index] = fileContents
process() if --remaining is 0
process = ->
fs.writeFile 'src/coffee/concat.coffee', appContents.join('\n\n'), 'utf8', (err) ->
throw err if err
exec 'coffee --compile -o src/app/js/ -j app.js src/coffee/concat.coffee', (err, stdout, stderr) ->
throw err if err
console.log stdout + stderr
fs.unlink 'src/coffee/concat.coffee', (err) ->
throw err if err
console.log 'Done.'