Sha256: 35cc27914bb4a98a11643d0470bf4977d7101c0542a521d3defbd848538c0090

Contents?: true

Size: 988 Bytes

Versions: 10

Compression:

Stored size: 988 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, "merging #{branch} into #{RGitFlow::Config.options[:develop]}"

          @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
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rgitflow-0.2.1.pre.alpha.pre.32 lib/rgitflow/tasks/feature/finish.rb
rgitflow-0.2.1.pre.alpha.pre.28 lib/rgitflow/tasks/feature/finish.rb
rgitflow-0.2.0.pre.alpha.pre.27 lib/rgitflow/tasks/feature/finish.rb
rgitflow-0.2.0.pre.alpha.pre.26 lib/rgitflow/tasks/feature/finish.rb
rgitflow-0.2.0.pre.alpha.pre.25 lib/rgitflow/tasks/feature/finish.rb
rgitflow-0.2.0 lib/rgitflow/tasks/feature/finish.rb
rgitflow-0.2.0.pre.alpha.pre.23 lib/rgitflow/tasks/feature/finish.rb
rgitflow-0.2.0.pre.alpha.pre.22 lib/rgitflow/tasks/feature/finish.rb
rgitflow-0.2.0.pre.alpha.pre.21 lib/rgitflow/tasks/feature/finish.rb
rgitflow-0.2.0.pre.alpha.pre.20 lib/rgitflow/tasks/feature/finish.rb