Last active
September 30, 2017 01:53
-
-
Save bmomberger-bitovi/e2d154994091e63eb11448dbfe4484b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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