class GitPivotalTrackerIntegration::Command::Finish
The class that encapsulates finishing a Pivotal Tracker Story
Public Instance Methods
run(argument)
click to toggle source
Finishes a Pivotal Tracker story by doing the following steps:
-
Check that the pending merge will be trivial
-
Merge the development branch into the root branch
-
Delete the development branch
-
Push changes to remote
@return [void]
# File lib/git-pivotal-tracker-integration/command/finish.rb, line 30 def run(argument) GitPivotalTrackerIntegration::Util::Git.verify_uncommitted_changes! github = @configuration.github story = @configuration.story(@project) print "Creating PR on Github... \n" pr = github.pull_requests.create( user: GitPivotalTrackerIntegration::Util::Git.org_name, repo: GitPivotalTrackerIntegration::Util::Git.repo_name, base: GitPivotalTrackerIntegration::Util::Git.root_branch, head: GitPivotalTrackerIntegration::Util::Git.branch_name, title: "[Delivers ##{story.id}] #{story.name}", body: "#{story.name}\n#{story.description}\nPivotal Task: #{story.url}" ) puts 'OK' print 'Finishing story on Pivotal Tracker... ' story.update( :current_state => 'finished', :owned_by => GitPivotalTrackerIntegration::Util::Git.get_config('user.name') ) puts 'OK' end