Class: GitPivotalTrackerIntegration::Command::Release

Inherits:
Base
  • Object
show all
Defined in:
lib/git-pivotal-tracker-integration/command/release.rb

Overview

The class that encapsulates releasing a Pivotal Tracker Story

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from GitPivotalTrackerIntegration::Command::Base

Instance Method Details

#run(filter) ⇒ void

This method returns an undefined value.

Releases a Pivotal Tracker story by doing the following steps:

  • Update the version to the release version

  • Create a tag for the release version

  • Update the version to the new development version

  • Push tag and changes to remote

Parameters:

  • filter (String, nil)

    a filter for selecting the release to start. This filter can be either:

    • a story id

    • nil



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/git-pivotal-tracker-integration/command/release.rb', line 36

def run(filter)
  story = GitPivotalTrackerIntegration::Util::Story.select_story(@project, filter.nil? ? 'release' : filter, 1)
  GitPivotalTrackerIntegration::Util::Story.pretty_print story

  updater = [
    GitPivotalTrackerIntegration::VersionUpdate::Gradle.new(@repository_root)
  ].find { |candidate| candidate.supports? }

  current_version = updater.current_version
  release_version = ask("Enter release version (current: #{current_version}): ")
  next_version = ask("Enter next development version (current: #{current_version}): ")

  updater.update_version release_version
  GitPivotalTrackerIntegration::Util::Git.create_release_tag release_version, story
  updater.update_version next_version
  GitPivotalTrackerIntegration::Util::Git.create_commit "#{next_version} Development", story

  GitPivotalTrackerIntegration::Util::Git.push GitPivotalTrackerIntegration::Util::Git.branch_name, "v#{release_version}"
end