Sha256: e62be6d97c7fe719304121c5e3e751996cbf9943f204863179ceea7631607947

Contents?: true

Size: 915 Bytes

Versions: 7

Compression:

Stored size: 915 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
          if @git.is_remote_branch? branch
            @git.push('origin', branch, {:delete => true})
          end

          @git.branch(branch).delete

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rgitflow-0.1.0 lib/rgitflow/tasks/hotfix/finish.rb
rgitflow-0.1.0.pre.alpha.pre.18 lib/rgitflow/tasks/hotfix/finish.rb
rgitflow-0.1.0.pre.alpha.pre.17 lib/rgitflow/tasks/hotfix/finish.rb
rgitflow-0.1.0.pre.alpha.pre.16 lib/rgitflow/tasks/hotfix/finish.rb
rgitflow-0.1.0.pre.alpha.pre.15 lib/rgitflow/tasks/hotfix/finish.rb
rgitflow-0.1.0.pre.alpha.pre.14 lib/rgitflow/tasks/hotfix/finish.rb
rgitflow-0.1.0.pre.alpha.pre.13 lib/rgitflow/tasks/hotfix/finish.rb