Blame view

node_modules/grunt/internal-tasks/subgrunt.js 976 Bytes
73bcce88   luigser   COMPONENTS
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
  /*
   * grunt
   * http://gruntjs.com/
   *
   * Copyright (c) 2014 "Cowboy" Ben Alman
   * Licensed under the MIT license.
   * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
   */
  
  'use strict';
  
  module.exports = function(grunt) {
  
    // Run sub-grunt files, because right now, testing tasks is a pain.
    grunt.registerMultiTask('subgrunt', 'Run a sub-gruntfile.', function() {
      var path = require('path');
      grunt.util.async.forEachSeries(this.filesSrc, function(gruntfile, next) {
        grunt.log.write('Loading ' + gruntfile + '...');
        grunt.util.spawn({
          grunt: true,
          args: ['--gruntfile', path.resolve(gruntfile)],
        }, function(error, result) {
          if (error) {
            grunt.log.error().error(result.stdout).writeln();
            next(new Error('Error running sub-gruntfile "' + gruntfile + '".'));
          } else {
            grunt.log.ok().verbose.ok(result.stdout);
            next();
          }
        });
      }, this.async());
    });
  
  };