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/rebase.rb Normal file
View File

@@ -0,0 +1,29 @@
require_relative './base'
module Feature
class Rebase < Feature::Base
def execute
parts = parse_branch(current_branch)
standard_branch = parts[:standard]
feature_branch = current_branch
remote_branch = remote_branch(feature_branch)
error "USAGE: feature rebase" unless standard_branch
error "invalid feature branch: #{feature_branch}" if standard_branches.include? feature_branch
run_cmd "git checkout #{standard_branch}"
run_cmd "git pull origin #{standard_branch}"
run_cmd "git checkout #{feature_branch}"
run_cmd "git rebase #{standard_branch}"
if remote_branch != ""
run_cmd "git push origin :#{feature_branch}"
end
run_cmd "git push origin #{feature_branch}"
end
end
end