Skip to content

Instantly share code, notes, and snippets.

@bmomberger-bitovi
Last active September 30, 2017 01:53
Show Gist options
  • Save bmomberger-bitovi/e2d154994091e63eb11448dbfe4484b5 to your computer and use it in GitHub Desktop.
Save bmomberger-bitovi/e2d154994091e63eb11448dbfe4484b5 to your computer and use it in GitHub Desktop.
var fs = require('fs');
var path = require('path');
var exec = require('child_process').exec;
module.exports = {
getOptions: function () {
return [{
name: "branch",
type: "input",
default: "codemod",
message: "What shall the branch be called?"
},{
name: "commitmsg",
type: "input",
default: "Applying codemods",
message: "What shall the commit message be?"
}];
},
run: function (directory, options) {
process.chdir(directory);
// Install nocycle as a dev dependency. Resove a Promise when finished.
var installs = new Promise(function(resolve, reject) {
exec(`git checkout -B "${options.branch}" && git commit -am "${options.commitmsg}" && git push -u origin ${options.branch}`, function(error) {
error ? reject(error) : resolve();
});
});
// Return control to landscaper when everything finishes or something fails.
return installs;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment