breakout feature into parts

This commit is contained in:
rkiel
2015-06-06 06:43:34 -04:00
parent d928791be0
commit 71f7a91065
7 changed files with 184 additions and 152 deletions

29
lib/feature/merge_to.rb Normal file
View File

@@ -0,0 +1,29 @@
require_relative './base'
module Feature
class MergeTo < Feature::Base
def execute
parts = parse_branch(current_branch)
if argv.size == 2
merge_to_branch = argv[1]
elsif argv.size == 1
merge_to_branch = parts[:standard]
else
error "USAGE: feature merge [branch]"
end
feature_branch = current_branch
error "invalid branch: #{merge_to_branch}" unless standard_branches.include? merge_to_branch
run_cmd "git checkout #{merge_to_branch}"
run_cmd "git pull origin #{merge_to_branch}"
run_cmd "git merge #{feature_branch}"
run_cmd "git push origin #{merge_to_branch}"
run_cmd "git checkout #{feature_branch}"
end
end
end