Sha256: 32d5a6d8664e63e200853ea52ea16a8dc8718666695a96ed2710ef91b9420397

Contents?: true

Size: 865 Bytes

Versions: 3

Compression:

Stored size: 865 Bytes

Contents

require 'rgitflow/tasks/task'

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

        protected

        def run
          status 'Finishing feature branch...'

          branch = @git.current_branch

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

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

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

          @git.branch(branch).delete

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

Version data entries

3 entries across 3 versions & 1 rubygems

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