tasks/required.js
function npmInstall(requires, done) {
    var npmBin = path.join(path.dirname(process.argv[0]), 'npm');
    if (process.platform === 'win32') { npmBin += '.cmd'; }
    async.forEachSeries(requires, function(module, next) {
      // skip existing modules
      if (grunt.file.exists(path.join('./node_modules/' + module))) {
        grunt.log.writeln(String('Module "' + module + '" already installed, skipping.').cyan);
        return next();
      }
      grunt.log.writeln('npm install ' + module + ' --save');
      // spawn npm install
      var s = grunt.util.spawn({
        cmd: npmBin,
        args: ['install', module, '--save']
      }, next);
      // write output
      s.stdout.on('data', function(buf) { grunt.log.write(String(buf)); });
      s.stderr.on('data', function(buf) { grunt.log.write(String(buf)); });
    }, done);
  }
function npmInstall(requires, done) {
    var npmBin = path.join(path.dirname(process.argv[0]), 'npm');
    if (process.platform === 'win32') { npmBin += '.cmd'; }
    async.forEachSeries(requires, function(module, next) {
      // skip existing modules
      if (grunt.file.exists(path.join('./node_modules/' + module))) {
        grunt.log.writeln(String('Module "' + module + '" already installed, skipping.').cyan);
        return next();
      }
      grunt.log.writeln('npm install ' + module + ' --save');
      // spawn npm install
      var s = grunt.util.spawn({
        cmd: npmBin,
        args: ['install', module, '--save']
      }, next);
      // write output
      s.stdout.on('data', function(buf) { grunt.log.write(String(buf)); });
      s.stderr.on('data', function(buf) { grunt.log.write(String(buf)); });
    }, done);
  }
function npmInstall ( requires , done ) { var npmBin = path . join ( path . dirname ( process . argv [ 0 ] ) , 'npm' ) ; if ( process . platform === 'win32' ) { npmBin += '.cmd' ; } async . forEachSeries ( requires , function ( module , next ) { // skip existing modules if ( grunt . file . exists ( path . join ( './node_modules/' + module ) ) ) { grunt . log . writeln ( String ( 'Module "' + module + '" already installed, skipping.' ) . cyan ) ; return next ( ) ; } grunt . log . writeln ( 'npm install ' + module + ' --save' ) ; // spawn npm install var s = grunt . util . spawn ( { cmd : npmBin , args : [ 'install' , module , '--save' ] } , next ) ; // write output s . stdout . on ( 'data' , function ( buf ) { grunt . log . write ( String ( buf ) ) ; } ) ; s . stderr . on ( 'data' , function ( buf ) { grunt . log . write ( String ( buf ) ) ; } ) ; } , done ) ; }
use npm to install given modules
use npm to install given modules