exports._gitAddAll = function(mainCallback) { command.open(root) .on('stdout', command.writeTo(process.stdout)) .on('stderr', command.writeTo(process.stderr)) .exec('git', ['add', '.']) .then(function() { mainCallback(); }); };
exports._gitCommit = function(mainCallback) { command.open(root) .on('stdout', command.writeTo(process.stdout)) .on('stderr', command.writeTo(process.stderr)) .exec('git', ['commit', '-m', 'Regenerate']) .then(function() { mainCallback(); }); };
function(mainCallback) { command.open(ROOT) .on('stdout', command.writeTo(process.stdout)) .on('stderr', command.writeTo(process.stderr)) .exec('git', ['checkout', dependency.version, '-f'], { cwd: dependency.folder }) .then(function() { mainCallback(); }); },
exports._gitPushToBranch = function(mainCallback, remote, branch) { command.open(root) .on('stdout', command.writeTo(process.stdout)) .on('stderr', command.writeTo(process.stderr)) .exec('git', ['push', remote, branch]) .then(function() { mainCallback(); }); };
function(mainCallback) { command.open(ROOT) .on('stdout', command.writeTo(process.stdout)) .on('stderr', command.writeTo(process.stderr)) .exec('git', ['pull', '--rebase', dependency.repo, dependency.version, '--progress'], { cwd: dependency.folder }) .then(function() { mainCallback(); }); }],
function(mainCallback) { command.open(root) .on('stdout', command.writeTo(process.stdout)) .on('stderr', command.writeTo(process.stdout)) .exec('git', ['fetch', dependency.repo, dependency.version], { cwd: dependency.folder }) .then(function() { mainCallback(); }); },
fsExtra.remove(folderPath, function(err) { if (err) { command.writeTo(err); } else { command.writeTo('Removed: ' + folder); mainCallback(); } });
fsExtra.copy(origin, destination, function(err) { if (err) { command.writeTo(err); } else { command.writeTo('Copied: ' + fileName); callback(); } });
exports._gitCurrentBranch = function(mainCallback) { command.open(root) .on('stdout', command.writeTo(process.stdout)) .on('stderr', command.writeTo(process.stderr)) .exec('git', ['symbolic-ref', 'HEAD']) .then(function() { var data = this.lastOutput.stdout; currentBranch = data.substring(data.lastIndexOf('/') + 1).trim(); mainCallback(); }); };
exports._gitAddFolder = function(mainCallback) { var repo = grunt.config([TASK.name, 'repo']); command.open(repo) .on('stdout', command.writeTo(process.stdout)) .on('stderr', command.writeTo(process.stderr)) .exec('git', ['add', '.']) .then(function() { mainCallback(); }); };
exports._gitCommit = function(mainCallback) { var repo = grunt.config([TASK.name, 'repo']); command.open(repo) .on('stdout', command.writeTo(process.stdout)) .on('stderr', command.writeTo(process.stderr)) .exec('git', ['commit', '-m', 'Regenerate API Docs']) .then(function() { mainCallback(); }); };
exports._runYuidoc = function(mainCallback) { var auiVersion = grunt.config([TASK.name, 'aui-version']); var configFile = path.join(grunt.config([TASK.name, 'theme']), 'yuidoc.json'); command.open(ROOT) .on('stdout', command.writeTo(process.stdout)) .on('stderr', command.writeTo(process.stderr)) .exec('yuidoc', ['-c', configFile, '--project-version', auiVersion, '--server']) .then(function() { mainCallback(); }); };
exports._cloneDependency = function(dependency, depCallback) { grunt.log.ok('Cloning: ' + dependency.repo + ' [' + dependency.version + ']'); command.open(ROOT) .on('stdout', command.writeTo(process.stdout)) .on('stderr', command.writeTo(process.stderr)) .exec('git', ['clone', dependency.repo, '-b', dependency.version, dependency.folder, '--progress'], { cwd: ROOT }) .then(function() { depCallback(); }); };
exports._gitGoToBranch = function(mainCallback) { var branch = grunt.config([TASK.name, 'branch']); var repo = grunt.config([TASK.name, 'repo']); command.open(repo) .on('stdout', command.writeTo(process.stdout)) .on('stderr', command.writeTo(process.stderr)) .exec('git', ['checkout', branch]) .then(function() { mainCallback(); }); };
exports._runShifter = function(mainCallback, target, args, cwd) { command.open(cwd) .on('stdout', command.writeTo(process.stdout)) .on('stderr', command.writeTo(process.stderr)) .exec('shifter', args) .then(function() { if (target === 'yui') { exports._setYuiCache(mainCallback, target); } else { mainCallback(); } }); };
exports._buildYuidoc = function(mainCallback) { var auiVersion = grunt.config([TASK.name, 'aui-version']); var configFile = path.join(grunt.config([TASK.name, 'theme']), 'yuidoc.json'); var sourceDir = grunt.config([TASK.name, 'src']); var destinationDir = grunt.config([TASK.name, 'dist']); command.open(sourceDir) .on('stdout', command.writeTo(process.stdout)) .on('stderr', command.writeTo(process.stderr)) .exec('yuidoc', ['-c', configFile, '-o', destinationDir, '--project-version', auiVersion]) .then(function() { mainCallback(); }); };
exports._runYogi = function(mainCallback) { var args = ['test']; if (grunt.config([TASK.name, 'coverage'])) { args.push('--coverage'); } command.open(ROOT) .on('stdout', command.writeTo(process.stdout)) .on('stderr', command.writeTo(process.stderr)) .exec('yogi', args) .then(function() { mainCallback(this.lastOutput.stdout); }); };
exports._gitGoToBranch = function(mainCallback, branch) { command.open(root) .on('stdout', command.writeTo(process.stdout)) .exec('git', ['checkout', branch]) .then(function() { mainCallback(); }); };
exports._updateDependency = function(dependency, depCallback) { log.info('Updating repo ' + dependency.repo + ' [' + dependency.version + ']...'); command.open(root) .on('stdout', command.writeTo(process.stdout)) .exec('git', ['rebase', 'origin', dependency.version], { cwd: dependency.folder }) .then(function() { depCallback(); }); };
exports._initDependency = function(dependency, depCallback) { log.info('Initializing repo ' + dependency.repo + ' [' + dependency.version + ']...'); command.open(root) .on('stdout', command.writeTo(process.stdout)) .exec('git', ['clone', dependency.repo, '-b', dependency.version, dependency.folder], { cwd: root }) .then(function() { depCallback(); }); };
exports._runYuidoc = function(mainCallback) { var auiVersion = grunt.config([TASK.name, 'aui-version']); var configFile = path.join(grunt.config([TASK.name, 'theme']), 'yuidoc.json'); var sourceDirs = grunt.config([TASK.name, 'src']); var commandArgs = []; sourceDirs.forEach(function(srcDir) { commandArgs.push(srcDir); }); commandArgs.push('-c', configFile, '--project-version', auiVersion, '--server'); command.open(ROOT) .on('stdout', command.writeTo(process.stdout)) .on('stderr', command.writeTo(process.stderr)) .exec('yuidoc', commandArgs) .then(function() { mainCallback(); }); };
prompt('Do you wish to initialize NPM modules [y/N] ', function(ans) { if (ans.toLowerCase().trim() === 'y') { command.open(root) .on('stdout', command.writeTo(process.stdout)) .exec('npm', ['install'], { cwd: root }) .then(function() { mainCallback(); }); } else { mainCallback(); } });
var _build = function() { file.mkdir(buildDir); var args = ['--build-dir', buildDir, '--replace-version=' + version ]; if (fast) { args.push('--no-lint'); args.push('--no-coverage'); args.push('--cache'); } if (walk) { args.push('--walk'); } command.open(srcDir) .on('stdout', command.writeTo(process.stdout)) .exec('shifter', args, { cwd: srcDir }) .then(function() { mainCallback(); }); };