git-pivotal-tracker-integration 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -2
  3. data/bin/git-finish +2 -2
  4. data/bin/git-release +1 -1
  5. data/bin/git-start +1 -1
  6. data/lib/git-pivotal-tracker-integration/command/base.rb +4 -4
  7. data/lib/git-pivotal-tracker-integration/command/command.rb +1 -1
  8. data/lib/git-pivotal-tracker-integration/command/configuration.rb +18 -18
  9. data/lib/git-pivotal-tracker-integration/command/finish.rb +7 -5
  10. data/lib/git-pivotal-tracker-integration/command/release.rb +6 -6
  11. data/lib/git-pivotal-tracker-integration/command/start.rb +10 -10
  12. data/lib/git-pivotal-tracker-integration/util/git.rb +39 -37
  13. data/lib/git-pivotal-tracker-integration/util/shell.rb +3 -3
  14. data/lib/git-pivotal-tracker-integration/util/story.rb +18 -22
  15. data/lib/git-pivotal-tracker-integration/util/util.rb +1 -1
  16. data/lib/git-pivotal-tracker-integration/version-update/gradle.rb +5 -5
  17. data/lib/git-pivotal-tracker-integration/version-update/version_update.rb +1 -1
  18. data/spec/git-pivotal-tracker-integration/command/base_spec.rb +6 -6
  19. data/spec/git-pivotal-tracker-integration/command/configuration_spec.rb +32 -32
  20. data/spec/git-pivotal-tracker-integration/command/finish_spec.rb +10 -10
  21. data/spec/git-pivotal-tracker-integration/command/release_spec.rb +18 -18
  22. data/spec/git-pivotal-tracker-integration/command/start_spec.rb +16 -16
  23. data/spec/git-pivotal-tracker-integration/util/git_spec.rb +98 -88
  24. data/spec/git-pivotal-tracker-integration/util/shell_spec.rb +11 -11
  25. data/spec/git-pivotal-tracker-integration/util/story_spec.rb +35 -35
  26. data/spec/git-pivotal-tracker-integration/version-update/gradle_spec.rb +18 -18
  27. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ab6418812979b1d65b9e4c9d33a67975836f6c8
4
- data.tar.gz: 45724b0f38f57772b3aeeac354c9ebebdec5ab5f
3
+ metadata.gz: 66744288befe65d8035b2d7a43272279638c29d1
4
+ data.tar.gz: 5c32fce8530761fb62d760b87437c990c97aec55
5
5
  SHA512:
6
- metadata.gz: f24d98487c07c4202880bf4bba635b4c6d5dd7e366cf154250653b0a040e5af8ee47024c161b129b89905ad9916d2df0711ad343c4764ef33efd22d2e98e0e8f
7
- data.tar.gz: a1a44ebbbc319615ca85f75db4bde6a43cd3e3468456e2405ed5984393add4dbc70110f81efb938ebee357c88ca5e15d741b9cde9193f2343c5b2d96548fafc5
6
+ metadata.gz: 11e9572c059a8e47ca41dbe7b655a1188af613b24adc84f78a3c2896f8dfc62bd824617b0a03a87482e2bd66e3380df358c2e7a9871fd5ed92a4bbc187b53256
7
+ data.tar.gz: 63592f6a4cddbe4024d569e15dcf4fab816b265b9c51745d4a761ffd60a1225f5b024f0c3a38ea6ea94f4dd00b31c834ea43a29c2df82004ad1dda6ff3b45576
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Git Pivotal Tracker Integration
2
- [![Gem Version](https://badge.fury.io/rb/git-pivotal-tracker-integration.png)](http://badge.fury.io/rb/git-pivotal-tracker-integration)
3
2
  [![Build Status](https://travis-ci.org/nebhale/git-pivotal-tracker-integration.png?branch=master)](https://travis-ci.org/nebhale/git-pivotal-tracker-integration)
3
+ [![Gem Version](https://badge.fury.io/rb/git-pivotal-tracker-integration.png)](http://badge.fury.io/rb/git-pivotal-tracker-integration)
4
+ [![Dependency Status](https://gemnasium.com/nebhale/git-pivotal-tracker-integration.png)](http://gemnasium.com/nebhale/git-pivotal-tracker-integration)
5
+ [![Code Climate](https://codeclimate.com/github/nebhale/git-pivotal-tracker-integration.png)](https://codeclimate.com/github/nebhale/git-pivotal-tracker-integration)
6
+
4
7
 
5
8
  `git-pivotal-tracker-integration` provides a set of additional Git commands to help developers when working with [Pivotal Tracker][pivotal-tracker].
6
9
 
@@ -109,7 +112,7 @@ If it doesn't exist already, a `prepare-commit-msg` commit hook is added to your
109
112
  #
110
113
  ```
111
114
 
112
- ### `git finish`
115
+ ### `git finish [--no-complete]`
113
116
  This command finishes a story by merging and cleaning up its branch and then pushing the changes to a remote server. This command can only be run one way.
114
117
 
115
118
  ```plain
@@ -134,6 +137,14 @@ Merge 12345678-lorem-ipsum to master
134
137
  [Completes #12345678]
135
138
  ```
136
139
 
140
+ If the `--no-complete` option is specified, the `Completed` statement in the commit message will be supressed.
141
+
142
+ ```plain
143
+ Merge 12345678-lorem-ipsum to master
144
+
145
+ [#12345678]
146
+ ```
147
+
137
148
  After merging, the development branch is deleted and the changes are pushed to the remote repository.
138
149
 
139
150
  ### `git release [issue]`
@@ -14,6 +14,6 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
- require "git-pivotal-tracker-integration/command/finish"
17
+ require 'git-pivotal-tracker-integration/command/finish'
18
18
 
19
- GitPivotalTrackerIntegration::Command::Finish.new().run
19
+ GitPivotalTrackerIntegration::Command::Finish.new().run ARGV[0]
@@ -14,6 +14,6 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
- require "git-pivotal-tracker-integration/command/release"
17
+ require 'git-pivotal-tracker-integration/command/release'
18
18
 
19
19
  GitPivotalTrackerIntegration::Command::Release.new().run ARGV[0]
@@ -14,6 +14,6 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
- require "git-pivotal-tracker-integration/command/start"
17
+ require 'git-pivotal-tracker-integration/command/start'
18
18
 
19
19
  GitPivotalTrackerIntegration::Command::Start.new().run ARGV[0]
@@ -13,10 +13,10 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
 
16
- require "git-pivotal-tracker-integration/command/command"
17
- require "git-pivotal-tracker-integration/command/configuration"
18
- require "git-pivotal-tracker-integration/util/git"
19
- require "pivotal-tracker"
16
+ require 'git-pivotal-tracker-integration/command/command'
17
+ require 'git-pivotal-tracker-integration/command/configuration'
18
+ require 'git-pivotal-tracker-integration/util/git'
19
+ require 'pivotal-tracker'
20
20
 
21
21
  # An abstract base class for all commands
22
22
  # @abstract Subclass and override {#run} to implement command functionality
@@ -13,7 +13,7 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
 
16
- require "git_pivotal_tracker_integration"
16
+ require 'git_pivotal_tracker_integration'
17
17
 
18
18
  # A module encapsulating the commands for the project
19
19
  module GitPivotalTrackerIntegration::Command
@@ -13,10 +13,10 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
 
16
- require "git-pivotal-tracker-integration/command/command"
17
- require "git-pivotal-tracker-integration/util/git"
18
- require "highline/import"
19
- require "pivotal-tracker"
16
+ require 'git-pivotal-tracker-integration/command/command'
17
+ require 'git-pivotal-tracker-integration/util/git'
18
+ require 'highline/import'
19
+ require 'pivotal-tracker'
20
20
 
21
21
  # A class that exposes configuration that commands can use
22
22
  class GitPivotalTrackerIntegration::Command::Configuration
@@ -24,15 +24,15 @@ class GitPivotalTrackerIntegration::Command::Configuration
24
24
  # Returns the user's Pivotal Tracker API token. If this token has not been
25
25
  # configured, prompts the user for the value. The value is checked for in
26
26
  # the _inherited_ Git configuration, but is stored in the _global_ Git
27
- # configuration so that it can be used across mutiple repositories.
27
+ # configuration so that it can be used across multiple repositories.
28
28
  #
29
29
  # @return [String] The user's Pivotal Tracker API token
30
30
  def api_token
31
- api_token = GitPivotalTrackerIntegration::Util::Git.get_config @@KEY_API_TOKEN, :inherited
31
+ api_token = GitPivotalTrackerIntegration::Util::Git.get_config KEY_API_TOKEN, :inherited
32
32
 
33
33
  if api_token.empty?
34
- api_token = ask("Pivotal API Token (found at https://www.pivotaltracker.com/profile): ").strip
35
- GitPivotalTrackerIntegration::Util::Git.set_config @@KEY_API_TOKEN, api_token, :global
34
+ api_token = ask('Pivotal API Token (found at https://www.pivotaltracker.com/profile): ').strip
35
+ GitPivotalTrackerIntegration::Util::Git.set_config KEY_API_TOKEN, api_token, :global
36
36
  puts
37
37
  end
38
38
 
@@ -46,18 +46,18 @@ class GitPivotalTrackerIntegration::Command::Configuration
46
46
  #
47
47
  # @return [String] The repository's Pivotal Tracker project id
48
48
  def project_id
49
- project_id = GitPivotalTrackerIntegration::Util::Git.get_config @@KEY_PROJECT_ID, :inherited
49
+ project_id = GitPivotalTrackerIntegration::Util::Git.get_config KEY_PROJECT_ID, :inherited
50
50
 
51
51
  if project_id.empty?
52
52
  project_id = choose do |menu|
53
- menu.prompt = "Choose project associated with this repository: "
53
+ menu.prompt = 'Choose project associated with this repository: '
54
54
 
55
55
  PivotalTracker::Project.all.sort_by { |project| project.name }.each do |project|
56
56
  menu.choice(project.name) { project.id }
57
57
  end
58
58
  end
59
59
 
60
- GitPivotalTrackerIntegration::Util::Git.set_config @@KEY_PROJECT_ID, project_id, :local
60
+ GitPivotalTrackerIntegration::Util::Git.set_config KEY_PROJECT_ID, project_id, :local
61
61
  puts
62
62
  end
63
63
 
@@ -67,26 +67,26 @@ class GitPivotalTrackerIntegration::Command::Configuration
67
67
  # Returns the story associated with the current development branch
68
68
  #
69
69
  # @param [PivotalTracker::Project] project the project the story belongs to
70
- # @return [PivotalTracker::Story] the story assocated with the current development branch
70
+ # @return [PivotalTracker::Story] the story associated with the current development branch
71
71
  def story(project)
72
- story_id = GitPivotalTrackerIntegration::Util::Git.get_config @@KEY_STORY_ID, :branch
72
+ story_id = GitPivotalTrackerIntegration::Util::Git.get_config KEY_STORY_ID, :branch
73
73
  project.stories.find story_id.to_i
74
74
  end
75
75
 
76
76
  # Stores the story associated with the current development branch
77
77
  #
78
- # @param [PivotalTracker::Story] story the story assocated with the current development branch
78
+ # @param [PivotalTracker::Story] story the story associated with the current development branch
79
79
  # @return [void]
80
80
  def story=(story)
81
- GitPivotalTrackerIntegration::Util::Git.set_config @@KEY_STORY_ID, story.id, :branch
81
+ GitPivotalTrackerIntegration::Util::Git.set_config KEY_STORY_ID, story.id, :branch
82
82
  end
83
83
 
84
84
  private
85
85
 
86
- @@KEY_API_TOKEN = "pivotal.api-token"
86
+ KEY_API_TOKEN = 'pivotal.api-token'.freeze
87
87
 
88
- @@KEY_PROJECT_ID = "pivotal.project-id"
88
+ KEY_PROJECT_ID = 'pivotal.project-id'.freeze
89
89
 
90
- @@KEY_STORY_ID = "pivotal-story-id"
90
+ KEY_STORY_ID = 'pivotal-story-id'.freeze
91
91
 
92
92
  end
@@ -13,9 +13,9 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
 
16
- require "git-pivotal-tracker-integration/command/base"
17
- require "git-pivotal-tracker-integration/command/command"
18
- require "git-pivotal-tracker-integration/util/git"
16
+ require 'git-pivotal-tracker-integration/command/base'
17
+ require 'git-pivotal-tracker-integration/command/command'
18
+ require 'git-pivotal-tracker-integration/util/git'
19
19
 
20
20
  # The class that encapsulates finishing a Pivotal Tracker Story
21
21
  class GitPivotalTrackerIntegration::Command::Finish < GitPivotalTrackerIntegration::Command::Base
@@ -27,9 +27,11 @@ class GitPivotalTrackerIntegration::Command::Finish < GitPivotalTrackerIntegrati
27
27
  # * Push changes to remote
28
28
  #
29
29
  # @return [void]
30
- def run
30
+ def run(argument)
31
+ no_complete = argument =~ /--no-complete/
32
+
31
33
  GitPivotalTrackerIntegration::Util::Git.trivial_merge?
32
- GitPivotalTrackerIntegration::Util::Git.merge(@configuration.story @project)
34
+ GitPivotalTrackerIntegration::Util::Git.merge(@configuration.story(@project), no_complete)
33
35
  GitPivotalTrackerIntegration::Util::Git.push GitPivotalTrackerIntegration::Util::Git.branch_name
34
36
  end
35
37
 
@@ -13,11 +13,11 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
 
16
- require "git-pivotal-tracker-integration/command/base"
17
- require "git-pivotal-tracker-integration/command/command"
18
- require "git-pivotal-tracker-integration/util/git"
19
- require "git-pivotal-tracker-integration/util/story"
20
- require "git-pivotal-tracker-integration/version-update/gradle"
16
+ require 'git-pivotal-tracker-integration/command/base'
17
+ require 'git-pivotal-tracker-integration/command/command'
18
+ require 'git-pivotal-tracker-integration/util/git'
19
+ require 'git-pivotal-tracker-integration/util/story'
20
+ require 'git-pivotal-tracker-integration/version-update/gradle'
21
21
 
22
22
  # The class that encapsulates releasing a Pivotal Tracker Story
23
23
  class GitPivotalTrackerIntegration::Command::Release < GitPivotalTrackerIntegration::Command::Base
@@ -34,7 +34,7 @@ class GitPivotalTrackerIntegration::Command::Release < GitPivotalTrackerIntegrat
34
34
  # * +nil+
35
35
  # @return [void]
36
36
  def run(filter)
37
- story = GitPivotalTrackerIntegration::Util::Story.select_story(@project, filter.nil? ? "release" : filter, 1)
37
+ story = GitPivotalTrackerIntegration::Util::Story.select_story(@project, filter.nil? ? 'release' : filter, 1)
38
38
  GitPivotalTrackerIntegration::Util::Story.pretty_print story
39
39
 
40
40
  updater = [
@@ -13,11 +13,11 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
 
16
- require "git-pivotal-tracker-integration/command/base"
17
- require "git-pivotal-tracker-integration/command/command"
18
- require "git-pivotal-tracker-integration/util/git"
19
- require "git-pivotal-tracker-integration/util/story"
20
- require "pivotal-tracker"
16
+ require 'git-pivotal-tracker-integration/command/base'
17
+ require 'git-pivotal-tracker-integration/command/command'
18
+ require 'git-pivotal-tracker-integration/util/git'
19
+ require 'git-pivotal-tracker-integration/util/story'
20
+ require 'pivotal-tracker'
21
21
 
22
22
  # The class that encapsulates starting a Pivotal Tracker Story
23
23
  class GitPivotalTrackerIntegration::Command::Start < GitPivotalTrackerIntegration::Command::Base
@@ -42,7 +42,7 @@ class GitPivotalTrackerIntegration::Command::Start < GitPivotalTrackerIntegratio
42
42
  GitPivotalTrackerIntegration::Util::Git.create_branch development_branch_name
43
43
  @configuration.story = story
44
44
 
45
- GitPivotalTrackerIntegration::Util::Git.add_hook "prepare-commit-msg", File.join(File.dirname(__FILE__), "prepare-commit-msg.sh")
45
+ GitPivotalTrackerIntegration::Util::Git.add_hook 'prepare-commit-msg', File.join(File.dirname(__FILE__), 'prepare-commit-msg.sh')
46
46
 
47
47
  start_on_tracker story
48
48
  end
@@ -56,12 +56,12 @@ class GitPivotalTrackerIntegration::Command::Start < GitPivotalTrackerIntegratio
56
56
  end
57
57
 
58
58
  def start_on_tracker(story)
59
- print "Starting story on Pivotal Tracker... "
59
+ print 'Starting story on Pivotal Tracker... '
60
60
  story.update(
61
- :current_state => "started",
62
- :owned_by => GitPivotalTrackerIntegration::Util::Git.get_config("user.name")
61
+ :current_state => 'started',
62
+ :owned_by => GitPivotalTrackerIntegration::Util::Git.get_config('user.name')
63
63
  )
64
- puts "OK"
64
+ puts 'OK'
65
65
  end
66
66
 
67
67
  end
@@ -13,8 +13,8 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
 
16
- require "git-pivotal-tracker-integration/util/shell"
17
- require "git-pivotal-tracker-integration/util/util"
16
+ require 'git-pivotal-tracker-integration/util/shell'
17
+ require 'git-pivotal-tracker-integration/util/util'
18
18
 
19
19
  # Utilities for dealing with Git
20
20
  class GitPivotalTrackerIntegration::Util::Git
@@ -26,21 +26,21 @@ class GitPivotalTrackerIntegration::Util::Git
26
26
  # @param [Boolean] overwrite whether to overwrite the hook if it already exists
27
27
  # @return [void]
28
28
  def self.add_hook(name, source, overwrite = false)
29
- hooks_directory = File.join repository_root, ".git", "hooks"
29
+ hooks_directory = File.join repository_root, '.git', 'hooks'
30
30
  hook = File.join hooks_directory, name
31
31
 
32
32
  if overwrite || !File.exist?(hook)
33
33
  print "Creating Git hook #{name}... "
34
34
 
35
35
  FileUtils.mkdir_p hooks_directory
36
- File.open(source, "r") do |input|
37
- File.open(hook, "w") do |output|
36
+ File.open(source, 'r') do |input|
37
+ File.open(hook, 'w') do |output|
38
38
  output.write(input.read)
39
39
  output.chmod(0755)
40
40
  end
41
41
  end
42
42
 
43
- puts "OK"
43
+ puts 'OK'
44
44
  end
45
45
  end
46
46
 
@@ -48,7 +48,7 @@ class GitPivotalTrackerIntegration::Util::Git
48
48
  #
49
49
  # @return [String] the name of the currently checked out branch
50
50
  def self.branch_name
51
- GitPivotalTrackerIntegration::Util::Shell.exec("git branch").scan(/\* (.*)/)[0][0]
51
+ GitPivotalTrackerIntegration::Util::Shell.exec('git branch').scan(/\* (.*)/)[0][0]
52
52
  end
53
53
 
54
54
  # Creates a branch with a given +name+. First pulls the current branch to
@@ -60,17 +60,19 @@ class GitPivotalTrackerIntegration::Util::Git
60
60
  # @return [void]
61
61
  def self.create_branch(name, print_messages = true)
62
62
  root_branch = branch_name
63
- root_remote = get_config @@KEY_REMOTE, :branch
63
+ root_remote = get_config KEY_REMOTE, :branch
64
64
 
65
65
  if print_messages; print "Pulling #{root_branch}... " end
66
- GitPivotalTrackerIntegration::Util::Shell.exec "git pull --quiet --ff-only"
67
- if print_messages; puts "OK" end
66
+ GitPivotalTrackerIntegration::Util::Shell.exec 'git pull --quiet --ff-only'
67
+ if print_messages; puts 'OK'
68
+ end
68
69
 
69
70
  if print_messages; print "Creating and checking out #{name}... " end
70
71
  GitPivotalTrackerIntegration::Util::Shell.exec "git checkout --quiet -b #{name}"
71
- set_config @@KEY_ROOT_BRANCH, root_branch, :branch
72
- set_config @@KEY_ROOT_REMOTE, root_remote, :branch
73
- if print_messages; puts "OK" end
72
+ set_config KEY_ROOT_BRANCH, root_branch, :branch
73
+ set_config KEY_ROOT_REMOTE, root_remote, :branch
74
+ if print_messages; puts 'OK'
75
+ end
74
76
  end
75
77
 
76
78
  # Creates a commit with a given message. The commit includes all change
@@ -98,13 +100,13 @@ class GitPivotalTrackerIntegration::Util::Git
98
100
 
99
101
  print "Creating tag v#{name}... "
100
102
 
101
- create_branch @@RELEASE_BRANCH_NAME, false
103
+ create_branch RELEASE_BRANCH_NAME, false
102
104
  create_commit "#{name} Release", story
103
105
  GitPivotalTrackerIntegration::Util::Shell.exec "git tag v#{name}"
104
106
  GitPivotalTrackerIntegration::Util::Shell.exec "git checkout --quiet #{root_branch}"
105
- GitPivotalTrackerIntegration::Util::Shell.exec "git branch --quiet -D #{@@RELEASE_BRANCH_NAME}"
107
+ GitPivotalTrackerIntegration::Util::Shell.exec "git branch --quiet -D #{RELEASE_BRANCH_NAME}"
106
108
 
107
- puts "OK"
109
+ puts 'OK'
108
110
  end
109
111
 
110
112
  # Returns a Git configuration value. This value is read using the +git
@@ -129,21 +131,21 @@ class GitPivotalTrackerIntegration::Util::Git
129
131
 
130
132
  # Merges the current branch to its root branch and deletes the current branch
131
133
  #
132
- # @param [PivotalTracker::Story] story the story associated with the current
133
- # branch
134
+ # @param [PivotalTracker::Story] story the story associated with the current branch
135
+ # @param [Boolean] no_complete whether to suppress the +Completes+ statement in the commit message
134
136
  # @return [void]
135
- def self.merge(story)
137
+ def self.merge(story, no_complete)
136
138
  development_branch = branch_name
137
- root_branch = get_config @@KEY_ROOT_BRANCH, :branch
139
+ root_branch = get_config KEY_ROOT_BRANCH, :branch
138
140
 
139
141
  print "Merging #{development_branch} to #{root_branch}... "
140
142
  GitPivotalTrackerIntegration::Util::Shell.exec "git checkout --quiet #{root_branch}"
141
- GitPivotalTrackerIntegration::Util::Shell.exec "git merge --quiet --no-ff -m \"Merge #{development_branch} to #{root_branch}\n\n[Completes ##{story.id}]\" #{development_branch}"
142
- puts "OK"
143
+ GitPivotalTrackerIntegration::Util::Shell.exec "git merge --quiet --no-ff -m \"Merge #{development_branch} to #{root_branch}\n\n[#{no_complete ? '' : 'Completes '}##{story.id}]\" #{development_branch}"
144
+ puts 'OK'
143
145
 
144
146
  print "Deleting #{development_branch}... "
145
147
  GitPivotalTrackerIntegration::Util::Shell.exec "git branch --quiet -D #{development_branch}"
146
- puts "OK"
148
+ puts 'OK'
147
149
  end
148
150
 
149
151
  # Push changes to the remote of the current branch
@@ -151,15 +153,15 @@ class GitPivotalTrackerIntegration::Util::Git
151
153
  # @param [String] refs the explicit references to push
152
154
  # @return [void]
153
155
  def self.push(*refs)
154
- remote = get_config @@KEY_REMOTE, :branch
156
+ remote = get_config KEY_REMOTE, :branch
155
157
 
156
158
  print "Pushing to #{remote}... "
157
- GitPivotalTrackerIntegration::Util::Shell.exec "git push --quiet #{remote} " + refs.join(" ")
158
- puts "OK"
159
+ GitPivotalTrackerIntegration::Util::Shell.exec "git push --quiet #{remote} " + refs.join(' ')
160
+ puts 'OK'
159
161
  end
160
162
 
161
163
  # Returns the root path of the current Git repository. The root is
162
- # determined by ascending the path hierarcy, starting with the current
164
+ # determined by ascending the path hierarchy, starting with the current
163
165
  # working directory (+Dir#pwd+), until a directory is found that contains a
164
166
  # +.git/+ sub directory.
165
167
  #
@@ -169,8 +171,8 @@ class GitPivotalTrackerIntegration::Util::Git
169
171
  repository_root = Dir.pwd
170
172
 
171
173
  until Dir.entries(repository_root).any? { |child| File.directory?(child) && (child =~ /^.git$/) }
172
- next_repository_root = File.expand_path("..", repository_root)
173
- abort("Current working directory is not in a Git repository") unless repository_root != next_repository_root
174
+ next_repository_root = File.expand_path('..', repository_root)
175
+ abort('Current working directory is not in a Git repository') unless repository_root != next_repository_root
174
176
  repository_root = next_repository_root
175
177
  end
176
178
 
@@ -210,33 +212,33 @@ class GitPivotalTrackerIntegration::Util::Git
210
212
  # @return [void]
211
213
  def self.trivial_merge?
212
214
  development_branch = branch_name
213
- root_branch = get_config @@KEY_ROOT_BRANCH, :branch
215
+ root_branch = get_config KEY_ROOT_BRANCH, :branch
214
216
 
215
217
  print "Checking for trivial merge from #{development_branch} to #{root_branch}... "
216
218
 
217
219
  GitPivotalTrackerIntegration::Util::Shell.exec "git checkout --quiet #{root_branch}"
218
- GitPivotalTrackerIntegration::Util::Shell.exec "git pull --quiet --ff-only"
220
+ GitPivotalTrackerIntegration::Util::Shell.exec 'git pull --quiet --ff-only'
219
221
  GitPivotalTrackerIntegration::Util::Shell.exec "git checkout --quiet #{development_branch}"
220
222
 
221
223
  root_tip = GitPivotalTrackerIntegration::Util::Shell.exec "git rev-parse #{root_branch}"
222
224
  common_ancestor = GitPivotalTrackerIntegration::Util::Shell.exec "git merge-base #{root_branch} #{development_branch}"
223
225
 
224
226
  if root_tip != common_ancestor
225
- abort "FAIL"
227
+ abort 'FAIL'
226
228
  end
227
229
 
228
- puts "OK"
230
+ puts 'OK'
229
231
  end
230
232
 
231
233
  private
232
234
 
233
- @@KEY_REMOTE = "remote"
235
+ KEY_REMOTE = 'remote'.freeze
234
236
 
235
- @@KEY_ROOT_BRANCH = "root-branch"
237
+ KEY_ROOT_BRANCH = 'root-branch'.freeze
236
238
 
237
- @@KEY_ROOT_REMOTE = "root-remote"
239
+ KEY_ROOT_REMOTE = 'root-remote'.freeze
238
240
 
239
- @@RELEASE_BRANCH_NAME = "pivotal-tracker-release"
241
+ RELEASE_BRANCH_NAME = 'pivotal-tracker-release'.freeze
240
242
 
241
243
  end
242
244