|
1 | 1 | module.exports = (grunt) ->
|
| 2 | + extend = require('util')._extend |
2 | 3 |
|
3 | 4 | # Project configuration.
|
4 | 5 | grunt.initConfig
|
@@ -46,6 +47,7 @@ module.exports = (grunt) ->
|
46 | 47 | build: ["<%= dirs.build %>"]
|
47 | 48 | dist: ["<%= dirs.dist %>"]
|
48 | 49 | package: ["<%= dirs.package%>"]
|
| 50 | + zepto: ["submodules/zepto/dist"] |
49 | 51 |
|
50 | 52 | coffee:
|
51 | 53 | jqt:
|
@@ -140,7 +142,7 @@ module.exports = (grunt) ->
|
140 | 142 | files: [
|
141 | 143 | expand: yes
|
142 | 144 | cwd: 'submodules/zepto/dist/'
|
143 |
| - src: 'zepto.js' |
| 145 | + src: ['zepto.js', 'zepto.min.js'] |
144 | 146 | dest: '<%= dirs.build %>/lib/zepto'
|
145 | 147 | ,
|
146 | 148 | src: 'submodules/zepto/src/touch.js'
|
@@ -178,11 +180,14 @@ module.exports = (grunt) ->
|
178 | 180 | expand: true
|
179 | 181 | ]
|
180 | 182 |
|
181 |
| - rake: |
| 183 | + "npm-command": |
182 | 184 | zepto:
|
183 |
| - params: "concat[fx:ajax:data:detect:event:form:polyfill:touch]" |
| 185 | + command: "run-script" |
| 186 | + script: "dist" |
| 187 | + params: "" |
184 | 188 | options:
|
185 | 189 | cwd: "submodules/zepto"
|
| 190 | + env: extend(process.env, {'MODULES': 'zepto event ajax form ie detect fx data touch'}) |
186 | 191 |
|
187 | 192 | compass:
|
188 | 193 | compile:
|
@@ -317,18 +322,25 @@ module.exports = (grunt) ->
|
317 | 322 | grunt.loadNpmTasks "grunt-contrib-compress"
|
318 | 323 | grunt.loadNpmTasks "grunt-update-submodules"
|
319 | 324 |
|
320 |
| - grunt.registerMultiTask "rake", "Compile a Ruby Package with Rake", -> |
| 325 | + grunt.registerMultiTask "npm-command", "Run an NPM command in a specific module", -> |
321 | 326 | cb = @async() # Tell grunt the task is async
|
322 |
| - options = @data["options"] |
| 327 | + command = @data["command"] |
323 | 328 | params = grunt.template.process(@data["params"])
|
324 |
| - exec = require("child_process").exec |
325 |
| - child = exec("rake " + params + "", options, (error, stdout, stderr) -> |
326 |
| - console.log "stdout: " + stdout if stdout |
| 329 | + script = grunt.template.process(@data["script"]) |
| 330 | + options = @data["options"] |
327 | 331 |
|
| 332 | + exec = require("child_process").exec |
| 333 | + child = exec("npm install", options, (error, stdout, stderr) -> |
| 334 | + grunt.log.write stdout if stdout |
| 335 | + grunt.log.error stdout if stderr |
328 | 336 | if error isnt null
|
329 |
| - console.log "error: " + error |
330 |
| - console.log "stderr: " + stdout |
331 |
| - cb() # Execute the callback when the async task is done |
| 337 | + cb(error) # Execute the callback when the async task is done |
| 338 | + else |
| 339 | + child = exec(["npm", command, script, params].join(' '), options, (error, stdout, stderr) -> |
| 340 | + grunt.log.write stdout if stdout |
| 341 | + grunt.log.error stdout if stderr |
| 342 | + cb(error) # Execute the callback when the async task is done |
| 343 | + ) |
332 | 344 | )
|
333 | 345 |
|
334 | 346 | grunt.registerTask "git-describe", "Describes current git commit", ->
|
@@ -357,7 +369,7 @@ module.exports = (grunt) ->
|
357 | 369 | grunt.renameTask 'watch', 'watch_files'
|
358 | 370 |
|
359 | 371 | # Git submodule updates
|
360 |
| - grunt.registerTask 'zepto', ['rake', 'copy:zepto', 'copy:jquery-bridge'] |
| 372 | + grunt.registerTask 'zepto', ['clean:zepto', 'npm-command:zepto', 'copy:zepto', 'copy:jquery-bridge'] |
361 | 373 |
|
362 | 374 | # Compile Scripts
|
363 | 375 | grunt.registerTask 'scripts', ['coffee', 'copy:prepare', 'concat', 'zepto']
|
|
0 commit comments