Exemplo n.º 1
0
 function npmLinkAndInstall(cwd, callback) {
   /**
     * Attempt to npm link global packages.
     * This may fail because of permissions, if it fails packages
     * will be installed locally using npm install
     */
   spawnSeries(
     [
       {
         command: 'npm',
         args: ['link', require('../package.json').name],
         options: {
           cwd: cwd,
           ignoreError: true,
           stdio: 'inherit'
         }
       },
       {
         command: 'npm',
         args: ['link', 'gulp'],
         options: {
           cwd: cwd,
           ignoreError: true,
           stdio: 'inherit'
         }
       },
       {
         command: 'npm',
         args: ['install'],
         options: {
           cwd: cwd,
           stdio: 'inherit'
         }
       }
     ],
     callback,
     function (child, i, cmdObj) {
       gutil.log(gutil.colors.blue('Starting: ' + cmdObj.command + ' ' + cmdObj.args.join(' ')));
       child.on('close', function (code) {
         if (code === 0) {
           gutil.log(gutil.colors.blue('Finished: ' + cmdObj.command + ' ' + cmdObj.args.join(' ')));
         } else if (cmdObj.options.ignoreError) {
           gutil.log(gutil.colors.red('Failed: ' + cmdObj.command + ' ' + cmdObj.args.join(' ')));
           gutil.log(gutil.colors.blue('Ignoring error and continuing (Package will be installed in npm install) ..'));
         }
       });
     }
   );
 }
Exemplo n.º 2
0
 function bowerInstall(cwd, callback) {
   spawnSeries(
       [
         {
           command: 'bower',
           args: ['install'],
           options: {
             cwd: cwd,
             stdio: 'inherit'
           }
         }
       ],
       callback,
       function (child, i, cmdObj) {
         gutil.log(gutil.colors.blue('Starting: ' + cmdObj.command + ' ' + cmdObj.args.join(' ')));
         child.on('close', function () {
           gutil.log(gutil.colors.blue('Finished: ' + cmdObj.command + ' ' + cmdObj.args.join(' ')));
         });
       }
   );
 }