source: Dev/trunk/node_modules/grunt/internal-tasks/subgrunt.js @ 516

Last change on this file since 516 was 516, checked in by hendrikvanantwerpen, 11 years ago

Enable deployment with Grunt.

File size: 976 bytes
Line 
1/*
2 * grunt
3 * http://gruntjs.com/
4 *
5 * Copyright (c) 2014 "Cowboy" Ben Alman
6 * Licensed under the MIT license.
7 * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
8 */
9
10'use strict';
11
12module.exports = function(grunt) {
13
14  // Run sub-grunt files, because right now, testing tasks is a pain.
15  grunt.registerMultiTask('subgrunt', 'Run a sub-gruntfile.', function() {
16    var path = require('path');
17    grunt.util.async.forEachSeries(this.filesSrc, function(gruntfile, next) {
18      grunt.log.write('Loading ' + gruntfile + '...');
19      grunt.util.spawn({
20        grunt: true,
21        args: ['--gruntfile', path.resolve(gruntfile)],
22      }, function(error, result) {
23        if (error) {
24          grunt.log.error().error(result.stdout).writeln();
25          next(new Error('Error running sub-gruntfile "' + gruntfile + '".'));
26        } else {
27          grunt.log.ok().verbose.ok(result.stdout);
28          next();
29        }
30      });
31    }, this.async());
32  });
33
34};
Note: See TracBrowser for help on using the repository browser.