Class: RGitFlow::Tasks::Feature::Finish
- Defined in:
- lib/rgitflow/tasks/feature/finish.rb
Constant Summary
Constants included from Printing
Printing::DEBUG_PREFIX, Printing::ERROR_PREFIX, Printing::INPUT_PREFIX, Printing::STATUS_PREFIX
Instance Attribute Summary
Attributes inherited from Task
#after, #before, #dependencies, #description, #name, #namespaces
Instance Method Summary collapse
-
#initialize(git) ⇒ Finish
constructor
A new instance of Finish.
- #run ⇒ Object protected
Methods inherited from Task
Methods included from Console
#execute, #invoke, #multi_task, #task?
Methods included from Printing
#debug, #error, #prompt, #status
Constructor Details
#initialize(git) ⇒ Finish
Returns a new instance of Finish.
7 8 9 |
# File 'lib/rgitflow/tasks/feature/finish.rb', line 7 def initialize(git) super(git, 'finish', 'Finish a feature branch', ['rgitflow', 'feature']) end |
Instance Method Details
#run ⇒ Object (protected)
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rgitflow/tasks/feature/finish.rb', line 13 def run status 'Finishing feature branch...' branch = @git.current_branch unless branch.start_with? RGitFlow::Config.[:feature] error 'Cannot finish a feature branch unless you are in a feature branch' abort end msg = %Q("merging #{branch} into #{RGitFlow::Config.[:develop]}") @git.branch(RGitFlow::Config.[:develop]).checkout @git.merge branch begin @git.commit_all msg rescue status 'develop branch is up-to-date' end @git.push if @git.is_remote_branch? branch @git.push('origin', branch, { :delete => true }) end @git.branch(branch).delete status "Finished feature branch #{branch}!" end |