Class: RGitFlow::Tasks::Release::Finish
- Defined in:
- lib/rgitflow/tasks/release/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 10 |
# File 'lib/rgitflow/tasks/release/finish.rb', line 7 def initialize(git) super(git, 'finish', 'Finish a release branch', ['rgitflow', 'release'], ['install']) end |
Instance Method Details
#run ⇒ Object (protected)
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/rgitflow/tasks/release/finish.rb', line 14 def run status 'Finishing release branch...' branch = @git.current_branch unless branch.start_with? RGitFlow::Config.[:release] error %Q(Cannot finish a release branch unless you are in a release 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 msg = %Q(merging #{branch} into #{RGitFlow::Config.[:master]}) @git.branch(RGitFlow::Config.[:master]).checkout @git.merge branch begin @git.commit_all msg rescue status 'master branch is up-to-date' end invoke 'rgitflow:scm:tag' @git.push # force re-creation of develop branch if @git.is_remote_branch? branch @git.push('origin', branch, { :delete => true }) end @git.branch(branch).delete @git.branch(RGitFlow::Config.[:develop]).checkout status "Finished release branch #{branch}!" end |