UNPKG

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