Skip to content

Instantly share code, notes, and snippets.

@franklinjavier
Created April 15, 2014 21:54
Show Gist options
  • Select an option

  • Save franklinjavier/10780464 to your computer and use it in GitHub Desktop.

Select an option

Save franklinjavier/10780464 to your computer and use it in GitHub Desktop.
Using git with Yoeman generator
InfoGenerator.prototype.gitCommit = function gitCommit() {
var done = this.async();
this.log('\n\nInitializing Git repository. If this fail, try running ' +
chalk.yellow.bold('git init') +
' and make a first commit manually');
var async = require('async');
async.series([
function (taskDone) {
exec('git init', taskDone);
},
function (taskDone) {
exec('git add . --all', taskDone);
},
function (taskDone) {
exec('git commit -m "Created playground"', taskDone);
}
], function (err) {
console.log(err);
if (err === 127) {
this.log('Could not find the ' + chalk.yellow.bold('git') + ' command. Make sure Git is installed on this machine');
return;
}
this.log(chalk.green('complete') + ' Git repository has been setup');
done();
}.bind(this));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment