tasks/gae.js
function run(command, auth, options, async, done, msgSuccess, msgSuccessAsync, msgFailure) {

        var args,
            flags,
            field,
            i,
            childProcess;

        // Pass auth.
        command = command.replace('{auth}', auth ? format('--email=%s --passin ', auth.email) : '');

        // Evaluate arguments to pass.
        args = '';
        for (field in options.args) {
            args += format('--%s=%s ', field, options.args[field]);
        }

        // Evaluate flags to pass.
        flags = '';
        for (i = 0; i < options.flags.length; ++i) {
            flags += format('--%s ', options.flags[i]);
        }

        command = command.replace('{args}', args).replace('{flags}', flags).replace('{path}', options.path);

        // Passin.
        if (auth) {
            command = format('echo %s | %s', auth.password, command);
        }

        // Run it asynchronously
        if (async) {
            command = COMMAND_ASYNC.
                replace('{command}', command).
                replace('{redirect}', options.asyncOutput ? '' : REDIRECT_DEVNULL);
        }

        grunt.log.debug(command);

        // Run the command.
        childProcess = exec(command, {}, function () {});

        // Listen to output
        if (options.stdout) {
            childProcess.stdout.on('data', function (d) {
                grunt.log.write(d);
            });
        }

        // Listen to errors.
        if (options.stderr) {
            childProcess.stderr.on('data', function (d) {
                grunt.log.error(d);
            });
        }

        // Listen to exit.
        childProcess.on('exit', function (code) {
            if (options.stdout) {
                if (code === 0 && async) {
                    grunt.log.subhead(
                        msgSuccessAsync ||
                        options.asyncOutput && 'Output from asynchronous operation follows.' ||
                        'Unable to determine success of asynchronous operation. For debugging please disable async mode or enable asyncOutput.'
                    );
                } else if (code === 0) {
                    grunt.log.ok(msgSuccess || 'Action executed successfully.');
                }
            }

            if (options.stderr && code !== 0) {
                grunt.log.error(msgFailure || 'Error executing the action.');
            }

            done();
        });

    }
function run(command, auth, options, async, done, msgSuccess, msgSuccessAsync, msgFailure) {

        var args,
            flags,
            field,
            i,
            childProcess;

        // Pass auth.
        command = command.replace('{auth}', auth ? format('--email=%s --passin ', auth.email) : '');

        // Evaluate arguments to pass.
        args = '';
        for (field in options.args) {
            args += format('--%s=%s ', field, options.args[field]);
        }

        // Evaluate flags to pass.
        flags = '';
        for (i = 0; i < options.flags.length; ++i) {
            flags += format('--%s ', options.flags[i]);
        }

        command = command.replace('{args}', args).replace('{flags}', flags).replace('{path}', options.path);

        // Passin.
        if (auth) {
            command = format('echo %s | %s', auth.password, command);
        }

        // Run it asynchronously
        if (async) {
            command = COMMAND_ASYNC.
                replace('{command}', command).
                replace('{redirect}', options.asyncOutput ? '' : REDIRECT_DEVNULL);
        }

        grunt.log.debug(command);

        // Run the command.
        childProcess = exec(command, {}, function () {});

        // Listen to output
        if (options.stdout) {
            childProcess.stdout.on('data', function (d) {
                grunt.log.write(d);
            });
        }

        // Listen to errors.
        if (options.stderr) {
            childProcess.stderr.on('data', function (d) {
                grunt.log.error(d);
            });
        }

        // Listen to exit.
        childProcess.on('exit', function (code) {
            if (options.stdout) {
                if (code === 0 && async) {
                    grunt.log.subhead(
                        msgSuccessAsync ||
                        options.asyncOutput && 'Output from asynchronous operation follows.' ||
                        'Unable to determine success of asynchronous operation. For debugging please disable async mode or enable asyncOutput.'
                    );
                } else if (code === 0) {
                    grunt.log.ok(msgSuccess || 'Action executed successfully.');
                }
            }

            if (options.stderr && code !== 0) {
                grunt.log.error(msgFailure || 'Error executing the action.');
            }

            done();
        });

    }
function run ( command , auth , options , async , done , msgSuccess , msgSuccessAsync , msgFailure ) { var args , flags , field , i , childProcess ; // Pass auth. command = command . replace ( '{auth}' , auth ? format ( '--email=%s --passin ' , auth . email ) : '' ) ; // Evaluate arguments to pass. args = '' ; for ( field in options . args ) { args += format ( '--%s=%s ' , field , options . args [ field ] ) ; } // Evaluate flags to pass. flags = '' ; for ( i = 0 ; i < options . flags . length ; ++ i ) { flags += format ( '--%s ' , options . flags [ i ] ) ; } command = command . replace ( '{args}' , args ) . replace ( '{flags}' , flags ) . replace ( '{path}' , options . path ) ; // Passin. if ( auth ) { command = format ( 'echo %s | %s' , auth . password , command ) ; } // Run it asynchronously if ( async ) { command = COMMAND_ASYNC . replace ( '{command}' , command ) . replace ( '{redirect}' , options . asyncOutput ? '' : REDIRECT_DEVNULL ) ; } grunt . log . debug ( command ) ; // Run the command. childProcess = exec ( command , { } , function ( ) { } ) ; // Listen to output if ( options . stdout ) { childProcess . stdout . on ( 'data' , function ( d ) { grunt . log . write ( d ) ; } ) ; } // Listen to errors. if ( options . stderr ) { childProcess . stderr . on ( 'data' , function ( d ) { grunt . log . error ( d ) ; } ) ; } // Listen to exit. childProcess . on ( 'exit' , function ( code ) { if ( options . stdout ) { if ( code === 0 && async ) { grunt . log . subhead ( msgSuccessAsync || options . asyncOutput && 'Output from asynchronous operation follows.' || 'Unable to determine success of asynchronous operation. For debugging please disable async mode or enable asyncOutput.' ) ; } else if ( code === 0 ) { grunt . log . ok ( msgSuccess || 'Action executed successfully.' ) ; } } if ( options . stderr && code !== 0 ) { grunt . log . error ( msgFailure || 'Error executing the action.' ) ; } done ( ) ; } ) ; }
Runs GAE command.
@param command
@param auth
@param options
@param async
@param done
@param msgSuccess
@param msgSuccessAsync
@param msgFailure
Runs GAE command .