11#!/usr/bin/env node
22
3- var path = require ( 'path' )
4- , fs = require ( 'fs' )
5- , spawn = require ( 'child_process' ) . spawn
6- , async = require ( 'async' )
7- , lib = GLOBAL . lib = require ( path . join ( __dirname , '..' , 'lib' ) )
8- , program = GLOBAL . program = require ( 'commander' ) ;
3+ var path = require ( 'path' )
4+ , fs = require ( 'fs' )
5+ , spawn = require ( 'child_process' ) . spawn
6+ , readline = require ( 'readline' )
7+ , async = require ( 'async' )
8+ , lib = GLOBAL . lib = require ( path . join ( __dirname , '..' , 'lib' ) )
9+ , program = GLOBAL . program = require ( 'commander' ) ;
910
1011
1112/** Define CLI Options
4748 var readPkg = require ( pkg )
4849 , hasPkgName = readPkg . hasOwnProperty ( 'name' ) ;
4950
50- if ( hasPkgName && readPkg . name . indexOf ( 'package.json' ) === - 1 ) {
51+ if ( hasPkgName && readPkg . name . indexOf ( 'package.json' ) === - 1 && readPkg . name . indexOf ( 'node-seed' ) === - 1 ) {
5152 folders . push ( {
5253 path : path . resolve ( path . join ( pkg , '..' ) )
5354 } ) ;
@@ -64,17 +65,19 @@ if (folders.length < 1) {
6465async . each (
6566 folders ,
6667 function run ( folder , next ) {
67- var proc = spawn ( [ 'grunt' , '--base' , folder . path , '--gruntfile' , path . resolve ( path . join ( folder . path , 'Gruntfile.js' ) ) , 'build' ] . join ( ' ' ) , function ( err ) {
68- if ( err !== null && err !== undefined ) {
69- next ( err ) ;
70- } else {
71- lib . utils . success ( 'Build for ' + folder . path + ' was successful' ) ;
72- next ( null ) ;
73- }
74- } ) ;
75-
76- proc . stdout . pipe ( process . stdout ) ;
77- proc . stderr . pipe ( process . stderr ) ;
68+ lib
69+ . util
70+ . grunt
71+ . runTask (
72+ folder . path , 'build' ,
73+ '--base' , folder . path ,
74+ '--gruntfile' , path . resolve ( path . join ( folder . path , 'Gruntfile.js' ) )
75+ )
76+ . then ( function ( ) {
77+ lib . utils . success ( 'Build for ' + folder . path + ' was successful' ) ;
78+ next ( null ) ;
79+ } )
80+ . catch ( next ) ;
7881 } ,
7982 function handleErr ( err ) {
8083 if ( ! ! err ) {
0 commit comments