function (yui3path, sha, callback) { // need to start the rest of the build with maven log.info('Running maven WAR build, time to grab a coffee...'); var dstOut = (userChoices.remote) ? userChoices.tmpClonePath : process.cwd(), logFile = path.join(userChoices.tmpClonePath, userChoices.username + '.log'), cmdline = 'node build/lib/package.js -c "../../../wria/combo?basePath=@WF2_VERSION@/build&"' + ' -l -i ' + sha + '-' + userChoices.branch + '-' + userChoices.username + ' -v ' + sha + ' -o ' + dstOut; cmd.run(cmdline, { pwd: userChoices.tmpClonePath, verbose: false, status: false, logFile: logFile }, function (err, stderr) { var msg = 'Maven build failed...'; if (err) { if (stderr) { log.echo(stderr); } _sendErrorEmailIfRemote({ msg: msg, attachments: logFile, }, function () { callback(err); }); } else { callback(null, yui3path, sha); } }); },
function (callback) { var cmdline = SHIFTER + ' --lint-stderr'; log.notice('Running shifter for ' + path.basename(buildPath) + '...'); cmd.run(cmdline, { verbose: verbose, status: !silent }, function (err, stderr) { if (!err) { callback(null); } else { callback(err, stderr); } }); },
function (callback) { var cmdline = 'compass watch'; log.notice('Compass is going to watch your code...'); cmd.run(cmdline, { verbose: true, status: false }, function (err) { if (!err) { callback(null); } else { callback(err); } }); }
function (callback) { var cmdline = SHIFTER + ' --coverage false --lint false --csslint false'; cmd.run(cmdline, { pwd: loaderDir, verbose: verbose, status: !silent }, function (err) { if (!err) { callback(null); } else { callback(err); } }); }
function (callback) { var cmdline = SHIFTER + ' --watch'; log.notice('Shifter is going to watch your code...'); cmd.run(cmdline, { verbose: true, status: false }, function (err) { if (!err) { callback(null); } else { callback(err); } }); }
function (callback) { var cmdline = SHIFTER + ' --coverage false --lint false --csslint false'; log.notice('Running shifter for Loader...'); cmd.run(cmdline, { pwd: loaderDir, verbose: verbose, status: !silent }, function (err, stderr) { if (!err) { callback(null); } else { callback(err, stderr); } }); }
function (callback) { var buildPath = options.srcPath, cmdline = SHIFTER + ' --coverage false --lint false --csslint false --walk'; cmd.run(cmdline, { pwd: buildPath, verbose: options.verbose, status: !options.silent }, function (err, data) { if (!err) { callback(null); } else { callback(err, data); } }); },
function (callback) { var buildPath = path.join(options.srcPath, '..', '..', 'build', 'lib'), cmdline = 'node wf2_prebuild_loader_dependencies.js'; cmd.run(cmdline, { pwd: buildPath, verbose: options.verbose, status: !options.silent }, function (err) { if (!err) { callback(null); } else { callback(err); } }); },
function (dstHooksPath, callback) { // need to run npm install in the hooks directory cmd.run('npm install', { status: true, verbose: false, pwd: dstHooksPath }, function (err) { if (err) { log.error('Unable to install npm packages in the hooks directory!'); callback(err); } else { log.success('Git hooks dependencies successfully installed'); callback(null); } }); },
}, function (err, wf2srcPath) { if (err) { // nothing we can do there... log.error('The current path cannot be served. Is it a wria2 path?'); log.echo(); done(-1); } else { var name = servers[options.server].name, command = servers[options.server].command, args = servers[options.server].args, url = servers[options.server].url, _afterServerStarted; _afterServerStarted = function (url) { log.success('Local server is up. Type CTRL+C to stop it.'); log.blue('URL is now available here:'); log.echo(url); log.echo(); utilities.openInBrowser({ confirm: true, url: url, message: 'Open it in your default browser?' }); }; if (options && options.args) { args = options.args; } cmd.run(command + ' ' + args, { pwd: wf2srcPath, foreground: true, trigger: { regex: (options.server === SERVER_TYPE_SELLECK) ? new RegExp(/Ferrari rides/) : new RegExp( /Starting server/), callback: function () { _afterServerStarted(url); } }, verbose: true, name: name }, done); } });
}, function (err, rootPath) { if (err) { // nothing we can do there... log.error('The current path cannot be built. Is it a wria2 path?'); log.echo(); done(-1); } else { var cmdline = 'node wf2_templates.js', buildPath = path.join(rootPath, 'build', 'lib'); log.info('Building all Soy templates...'); log.echo('Running: ' + cmdline); cmd.run(cmdline, { pwd: buildPath, status: false, verbose: true }, done); } });
function (callback) { if (options.clean) { // user wants to clear CSS cache var cmdline = COMPASS + ' clean'; log.notice('Removing generated CSS files and the SASS cache...'); cmd.run(cmdline, { verbose: verbose, status: !silent }, function (err, stderr) { if (!err) { callback(null); } else { callback(err, stderr); } }); } else { callback(); } },
function (callback) { var buildPath = path.join(options.srcPath, 'wf2'), cmdline = SHIFTER + ' --coverage false --lint false --csslint false'; if (fs.existsSync(buildPath)) { cmd.run(cmdline, { pwd: buildPath, verbose: options.verbose, status: !options.silent }, function (err, data) { if (!err) { callback(null); } else { callback(err, data); } }); } else { callback(); } }
}, function (err, wf2srcPath) { if (err) { // nothing we can do there... log.error('The current path cannot be served. Is it a wria2 path?'); log.echo(); done(-1); } else { var name = servers[options.server].name, command = servers[options.server].command, args = servers[options.server].args; if (options && options.args) { args = options.args; } cmd.run(command + ' ' + args, { pwd: wf2srcPath, foreground: true, name: name }, done); } });
function (callback) { var cmdline = SHIFTER + ' --watch'; log.notice('Shifter is going to watch your code...'); cmd.run(cmdline, { verbose: true, status: false, foreground: (process.platform === 'win32') ? false : true, trigger: [{ onlyOnce: false, regex: new RegExp(/build exited with 0/), callback: function () { var msg = 'Build looks good...'; log.success(msg); notifier.notify({ message: msg }); } }, { onlyOnce: false, regex: new RegExp(/build failed/), callback: function () { var msg = 'Ooops build failed...'; log.error(msg); notifier.notify({ message: msg, sound: 'Sosumi' }); } }] }, function (err) { if (!err) { callback(null); } else { callback(err); } }); },