UNPKG

2.23 kBtext/coffeescriptView Raw
1log = require "id-debug"
2lsr = require "lsr"
3
4defaults = {}
5
6sourceDirectoryPath = "src"
7targetDirectoryPath = "build"
8testDirectoryPath = "test"
9
10defaults.browserify =
11 enabled: true
12 paths: [ "#{targetDirectoryPath}/client/js/app" ]
13 entryFilePath: "#{targetDirectoryPath}/client/js/app/app.js"
14 targetFilename: "app.bundle.js"
15 targetDirectoryPath: "#{targetDirectoryPath}/client/js/app"
16
17defaults.clean =
18 enabled: true
19 targetDirectoryPath: targetDirectoryPath
20
21defaults.coffee =
22 enabled: true
23 sourceDirectoryPath: sourceDirectoryPath
24 targetDirectoryPath: targetDirectoryPath
25
26defaults.copy =
27 enabled: true
28 excluded: [ "**/*.coffee", "**/*.less" ]
29 sourceDirectoryPath: sourceDirectoryPath
30 targetDirectoryPath: targetDirectoryPath
31
32defaults.documentation =
33 enabled: true
34 sourceDirectoryPath: sourceDirectoryPath
35 targetDirectoryPath: targetDirectoryPath
36
37defaults.less =
38 enabled: true
39 entryFilePath: "#{sourceDirectoryPath}/client/less/app.less"
40 targetDirectoryPath: "#{targetDirectoryPath}/client/css"
41
42defaults.livereload =
43 enabled: true
44
45defaults.nodemon =
46 enabled: true
47 entryFilePath: "app.js"
48 watchGlob: [ "#{targetDirectoryPath}/server/**/*.js" ]
49
50defaults.forever =
51 enabled: true
52 entryFilePath: "app.js"
53 watchDirectoryPath: sourceDirectoryPath
54
55defaults.tests =
56 enabled: true
57 directoryPath: "test"
58
59defaults.watch =
60 enabled: true
61 sourceDirectoryPath: sourceDirectoryPath
62 testDirectoryPath: testDirectoryPath
63
64applyDefaults = (options) ->
65 for task, taskOptions of defaults
66 if typeof taskOptions is "object"
67 for k, v of taskOptions
68 unless options[task]?
69 options[task] = {}
70
71 unless options[task][k]?
72 options[task][k] = v
73 else
74 options[task] = taskOptions
75
76module.exports = (options = {}) ->
77 tasksDirectoryPath = "#{__dirname}/tasks"
78
79 applyDefaults options
80
81 global.idProjectOptions = options
82
83 stats = lsr.sync tasksDirectoryPath
84
85 for stat in stats
86 unless stat.isDirectory()
87 log.debug "Requiring module", stat.fullPath
88
89 require stat.fullPath
90
91 return