Sha256: cd7925439b08907dccf1721b46f7a7ccbf775dbfcce615b7844bf6b1e30a5ce5

Contents?: true

Size: 856 Bytes

Versions: 2

Compression:

Stored size: 856 Bytes

Contents

require 'rgitflow/tasks/task'

module RGitFlow
  module Tasks
    class Hotfix
      class Finish < RGitFlow::Tasks::Task
        def initialize(git)
          super(git, 'finish', 'Finish a hotfix branch', ['rgitflow', 'hotfix'])
        end

        protected

        def run
          status 'Finishing hotfix branch...'

          branch = @git.current_branch

          unless branch.start_with? RGitFlow::Config.options[:hotfix]
            error 'Cannot finish a hotfix branch unless you are in a hotfix branch'
            abort
          end

          @git.branch(RGitFlow::Config.options[:master]).checkout
          @git.merge branch

          @git.push
          @git.push('origin', branch, {:delete => true})

          @git.branch(branch).delete

          status "Finished hotfix branch #{branch}!"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rgitflow-0.1.0.pre.alpha.pre.12 lib/rgitflow/tasks/hotfix/finish.rb
rgitflow-0.1.0.pre.alpha.pre.11 lib/rgitflow/tasks/hotfix/finish.rb