started end

This commit is contained in:
rkiel
2019-07-14 22:04:51 -04:00
parent 604d3d84c4
commit 48d64da20b
2 changed files with 60 additions and 0 deletions

59
bin/creature-end Executable file
View File

@@ -0,0 +1,59 @@
#!/usr/bin/env node
const _ = require("lodash");
const path = x => require("../" + x);
const immutable = path("js/immutable");
const git = path("js/git");
const shell = path("js/shell");
const commander = require("commander");
const program = new commander.Command();
program.parse(process.argv);
function endFeatureBranch(dp) {
const cmds = [
"git fetch origin -p",
"git fetch origin --tags",
`git merge origin/${dp.currentBranch}`,
`git checkout -b ${dp.featureBranch}`,
`git push -u origin ${dp.featureBranch}`
];
return _.reduce(
cmds,
(accum, elem) => {
return accum
.then(() => console.log(elem))
.then(() => console.log())
.then(() => shell.run(elem));
},
Promise.resolve({})
);
}
// function setBranchParts(dp) {
// def parse_branch (branch)
// parts = branch.split('-')
// error "invalid branch: user-standard-feature" unless parts.size > 2
//
// user = parts.shift
// standard = parts.shift
// error "invalid user: #{user}" unless [ENV['FEATURE_USER'],ENV['USER']].include? user
// error "invalid branch: #{standard}" unless standard_branches.include? standard or standard =~ release_branch_pattern
// feature = parts.join('-')
// { user: user, standard: standard, feature: feature }
// }
function toPromise(dp) {
return Promise.resolve(dp);
}
const x = toPromise({ program })
.then(setStandardBranches)
.then(setFeatureName)
.then(validateFeatureName)
.then(setPrefix)
.then(setCurrentBranch)
.then(validateCurrentBranch)
.then(setFeatureBranch)
.then(createFeatureBranch)
.catch(err => console.error(err));