git-pivotal-tracker-integration 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +34 -1
  3. data/bin/git-finish +16 -2
  4. data/bin/git-release +19 -0
  5. data/bin/git-start +16 -2
  6. data/lib/git-pivotal-tracker-integration/command/base.rb +47 -0
  7. data/lib/git-pivotal-tracker-integration/{base.rb → command/command.rb} +3 -14
  8. data/lib/git-pivotal-tracker-integration/command/configuration.rb +92 -0
  9. data/lib/git-pivotal-tracker-integration/command/finish.rb +36 -0
  10. data/lib/git-pivotal-tracker-integration/command/prepare-commit-msg.sh +26 -0
  11. data/lib/git-pivotal-tracker-integration/command/release.rb +56 -0
  12. data/lib/git-pivotal-tracker-integration/command/start.rb +64 -0
  13. data/lib/git-pivotal-tracker-integration/util/git.rb +242 -0
  14. data/lib/git-pivotal-tracker-integration/util/shell.rb +36 -0
  15. data/lib/git-pivotal-tracker-integration/util/story.rb +128 -0
  16. data/lib/git-pivotal-tracker-integration/util/util.rb +20 -0
  17. data/lib/git-pivotal-tracker-integration/version-update/gradle.rb +64 -0
  18. data/lib/git-pivotal-tracker-integration/version-update/version_update.rb +20 -0
  19. data/lib/git_pivotal_tracker_integration.rb +18 -0
  20. data/spec/git-pivotal-tracker-integration/command/base_spec.rb +38 -0
  21. data/spec/git-pivotal-tracker-integration/command/configuration_spec.rb +91 -0
  22. data/spec/git-pivotal-tracker-integration/command/finish_spec.rb +45 -0
  23. data/spec/git-pivotal-tracker-integration/command/release_spec.rb +57 -0
  24. data/spec/git-pivotal-tracker-integration/command/start_spec.rb +50 -0
  25. data/spec/git-pivotal-tracker-integration/util/git_spec.rb +239 -0
  26. data/spec/git-pivotal-tracker-integration/util/shell_spec.rb +52 -0
  27. data/spec/git-pivotal-tracker-integration/util/story_spec.rb +137 -0
  28. data/spec/git-pivotal-tracker-integration/version-update/gradle_spec.rb +74 -0
  29. metadata +104 -21
  30. data/lib/git-pivotal-tracker-integration/finish.rb +0 -106
  31. data/lib/git-pivotal-tracker-integration/pivotal_configuration.rb +0 -90
  32. data/lib/git-pivotal-tracker-integration/prepare-commit-msg.sh +0 -12
  33. data/lib/git-pivotal-tracker-integration/start.rb +0 -167
@@ -0,0 +1,52 @@
1
+ # Git Pivotal Tracker Integration
2
+ # Copyright (c) 2013 the original author or authors.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ require "spec_helper"
17
+ require "git-pivotal-tracker-integration/util/shell"
18
+
19
+ describe GitPivotalTrackerIntegration::Util::Shell do
20
+
21
+ before do
22
+ $stdout = StringIO.new
23
+ $stderr = StringIO.new
24
+ end
25
+
26
+ it "should return result when exit code is 0" do
27
+ GitPivotalTrackerIntegration::Util::Shell.should_receive(:`).with("test_command").and_return("test_result")
28
+ $?.should_receive(:exitstatus).and_return(0)
29
+
30
+ result = GitPivotalTrackerIntegration::Util::Shell.exec "test_command"
31
+
32
+ expect(result).to eq("test_result")
33
+ end
34
+
35
+ it "should abort with 'FAIL' when the exit code is not 0" do
36
+ GitPivotalTrackerIntegration::Util::Shell.should_receive(:`).with("test_command")
37
+ $?.should_receive(:exitstatus).and_return(-1)
38
+
39
+ lambda { GitPivotalTrackerIntegration::Util::Shell.exec "test_command" }.should raise_error(SystemExit)
40
+
41
+ expect($stderr.string).to match(/FAIL/)
42
+ end
43
+
44
+ it "should return result when the exit code is not 0 and told not to abort on failure" do
45
+ GitPivotalTrackerIntegration::Util::Shell.should_receive(:`).with("test_command")
46
+ $?.should_receive(:exitstatus).and_return(-1)
47
+
48
+ GitPivotalTrackerIntegration::Util::Shell.exec "test_command", false
49
+ end
50
+
51
+
52
+ end
@@ -0,0 +1,137 @@
1
+ # Git Pivotal Tracker Integration
2
+ # Copyright (c) 2013 the original author or authors.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ require "spec_helper"
17
+ require "git-pivotal-tracker-integration/util/story"
18
+ require "pivotal-tracker"
19
+
20
+ describe GitPivotalTrackerIntegration::Util::Story do
21
+
22
+ before do
23
+ $stdout = StringIO.new
24
+ $stderr = StringIO.new
25
+
26
+ @project = double("project")
27
+ @stories = double("stories")
28
+ @story = double("story")
29
+ @menu = double("menu")
30
+ end
31
+
32
+ it "should pretty print story information" do
33
+ story = double("story")
34
+ story.should_receive(:name)
35
+ story.should_receive(:description).and_return("description-1\ndescription-2")
36
+ PivotalTracker::Note.should_receive(:all).and_return([
37
+ PivotalTracker::Note.new(:noted_at => Date.new, :text => "note-1")
38
+ ])
39
+
40
+ GitPivotalTrackerIntegration::Util::Story.pretty_print story
41
+
42
+ expect($stdout.string).to eq(
43
+ " Title: \n" +
44
+ "Description: description-1\n" +
45
+ " description-2\n" +
46
+ " Note 1: note-1\n" +
47
+ "\n")
48
+ end
49
+
50
+ it "should not pretty print description or notes if there are none (empty)" do
51
+ story = double("story")
52
+ story.should_receive(:name)
53
+ story.should_receive(:description)
54
+ PivotalTracker::Note.should_receive(:all).and_return([])
55
+
56
+ GitPivotalTrackerIntegration::Util::Story.pretty_print story
57
+
58
+ expect($stdout.string).to eq(
59
+ " Title: \n" +
60
+ "\n")
61
+ end
62
+
63
+ it "should not pretty print description or notes if there are none (nil)" do
64
+ story = double("story")
65
+ story.should_receive(:name)
66
+ story.should_receive(:description).and_return("")
67
+ PivotalTracker::Note.should_receive(:all).and_return([])
68
+
69
+ GitPivotalTrackerIntegration::Util::Story.pretty_print story
70
+
71
+ expect($stdout.string).to eq(
72
+ " Title: \n" +
73
+ "\n")
74
+ end
75
+
76
+ it "should select a story directly if the filter is a number" do
77
+ @project.should_receive(:stories).and_return(@stories)
78
+ @stories.should_receive(:find).with(12345678).and_return(@story)
79
+
80
+ story = GitPivotalTrackerIntegration::Util::Story.select_story @project, "12345678"
81
+
82
+ expect(story).to be(@story)
83
+ end
84
+
85
+ it "should select a story if the result of the query is a single story" do
86
+ @project.should_receive(:stories).and_return(@stories)
87
+ @stories.should_receive(:all).with(
88
+ :current_state => ["rejected", "unstarted", "unscheduled"],
89
+ :limit => 1,
90
+ :story_type => "release"
91
+ ).and_return([@story])
92
+
93
+ story = GitPivotalTrackerIntegration::Util::Story.select_story @project, "release", 1
94
+
95
+ expect(story).to be(@story)
96
+ end
97
+
98
+ it "should prompt the user for a story if the result of the query is more than a single story" do
99
+ @project.should_receive(:stories).and_return(@stories)
100
+ @stories.should_receive(:all).with(
101
+ :current_state => ["rejected", "unstarted", "unscheduled"],
102
+ :limit => 5,
103
+ :story_type => "feature"
104
+ ).and_return([
105
+ PivotalTracker::Story.new(:name => "name-1"),
106
+ PivotalTracker::Story.new(:name => "name-2")
107
+ ])
108
+ @menu.should_receive(:prompt=)
109
+ @menu.should_receive(:choice).with("name-1")
110
+ @menu.should_receive(:choice).with("name-2")
111
+ GitPivotalTrackerIntegration::Util::Story.should_receive(:choose) { |&arg| arg.call @menu }.and_return(@story)
112
+
113
+ story = GitPivotalTrackerIntegration::Util::Story.select_story @project, "feature"
114
+
115
+ expect(story).to be(@story)
116
+ end
117
+
118
+ it "should prompt the user with the story type if no filter is specified" do
119
+ @project.should_receive(:stories).and_return(@stories)
120
+ @stories.should_receive(:all).with(
121
+ :current_state => ["rejected", "unstarted", "unscheduled"],
122
+ :limit => 5
123
+ ).and_return([
124
+ PivotalTracker::Story.new(:story_type => "chore", :name => "name-1"),
125
+ PivotalTracker::Story.new(:story_type => "bug", :name => "name-2")
126
+ ])
127
+ @menu.should_receive(:prompt=)
128
+ @menu.should_receive(:choice).with("CHORE name-1")
129
+ @menu.should_receive(:choice).with("BUG name-2")
130
+ GitPivotalTrackerIntegration::Util::Story.should_receive(:choose) { |&arg| arg.call @menu }.and_return(@story)
131
+
132
+ story = GitPivotalTrackerIntegration::Util::Story.select_story @project
133
+
134
+ expect(story).to be(@story)
135
+ end
136
+
137
+ end
@@ -0,0 +1,74 @@
1
+ # Git Pivotal Tracker Integration
2
+ # Copyright (c) 2013 the original author or authors.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ require "spec_helper"
17
+ require "git-pivotal-tracker-integration/version-update/gradle"
18
+
19
+ describe GitPivotalTrackerIntegration::VersionUpdate::Gradle do
20
+
21
+ it "should not support if there is no gradle.properties file" do
22
+ Dir.mktmpdir do |root|
23
+ updater = GitPivotalTrackerIntegration::VersionUpdate::Gradle.new(root)
24
+
25
+ expect(updater.supports?).to be_false
26
+ end
27
+ end
28
+
29
+ it "should not support if there is no version in the gradle.properties file" do
30
+ Dir.mktmpdir do |root|
31
+ gradle_properties = File.expand_path "gradle.properties", root
32
+ File.open(gradle_properties, "w") { |file| file.write "foo=bar" }
33
+
34
+ updater = GitPivotalTrackerIntegration::VersionUpdate::Gradle.new(root)
35
+
36
+ expect(updater.supports?).to be_false
37
+ end
38
+ end
39
+
40
+ it "should support if there is a version in the gradle.properties file" do
41
+ Dir.mktmpdir do |root|
42
+ gradle_properties = File.expand_path "gradle.properties", root
43
+ File.open(gradle_properties, "w") { |file| file.write "version=1" }
44
+
45
+ updater = GitPivotalTrackerIntegration::VersionUpdate::Gradle.new(root)
46
+
47
+ expect(updater.supports?).to be_true
48
+ end
49
+ end
50
+
51
+ it "returns the current version" do
52
+ Dir.mktmpdir do |root|
53
+ gradle_properties = File.expand_path "gradle.properties", root
54
+ File.open(gradle_properties, "w") { |file| file.write "version=1" }
55
+
56
+ updater = GitPivotalTrackerIntegration::VersionUpdate::Gradle.new(root)
57
+
58
+ expect(updater.current_version).to eq("1")
59
+ end
60
+ end
61
+
62
+ it "returns the current version" do
63
+ Dir.mktmpdir do |root|
64
+ gradle_properties = File.expand_path "gradle.properties", root
65
+ File.open(gradle_properties, "w") { |file| file.write "version=1" }
66
+
67
+ updater = GitPivotalTrackerIntegration::VersionUpdate::Gradle.new(root)
68
+
69
+ updater.update_version "2"
70
+
71
+ File.open(gradle_properties, "r") { |file| expect(file.read).to eq("version=2") }
72
+ end
73
+ end
74
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-pivotal-tracker-integration
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Hale
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-11 00:00:00.000000000 Z
11
+ date: 2013-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 1.6.16
19
+ version: '1.6'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 1.6.16
26
+ version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pivotal-tracker
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 0.5.10
33
+ version: '0.5'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: 0.5.10
40
+ version: '0.5'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -56,38 +56,111 @@ dependencies:
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '10.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: redcarpet
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 2.2.2
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
67
81
  - !ruby/object:Gem::Version
68
- version: '0'
82
+ version: 2.2.2
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '2.13'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '2.13'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: '0.7'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '0.7'
111
+ - !ruby/object:Gem::Dependency
112
+ name: yard
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 0.8.6.1
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: 0.8.6.1
69
125
  description: Provides a set of additional Git commands to help developers when working
70
126
  with Pivotal Tracker
71
127
  email: nebhale@nebhale.com
72
128
  executables:
73
129
  - git-finish
130
+ - git-release
74
131
  - git-start
75
132
  extensions: []
76
- extra_rdoc_files:
77
- - README.md
78
- - LICENSE
79
- - NOTICE
133
+ extra_rdoc_files: []
80
134
  files:
81
135
  - LICENSE
82
136
  - NOTICE
83
137
  - README.md
84
- - lib/git-pivotal-tracker-integration/base.rb
85
- - lib/git-pivotal-tracker-integration/finish.rb
86
- - lib/git-pivotal-tracker-integration/pivotal_configuration.rb
87
- - lib/git-pivotal-tracker-integration/start.rb
88
- - lib/git-pivotal-tracker-integration/prepare-commit-msg.sh
138
+ - lib/git-pivotal-tracker-integration/command/base.rb
139
+ - lib/git-pivotal-tracker-integration/command/command.rb
140
+ - lib/git-pivotal-tracker-integration/command/configuration.rb
141
+ - lib/git-pivotal-tracker-integration/command/finish.rb
142
+ - lib/git-pivotal-tracker-integration/command/release.rb
143
+ - lib/git-pivotal-tracker-integration/command/start.rb
144
+ - lib/git-pivotal-tracker-integration/util/git.rb
145
+ - lib/git-pivotal-tracker-integration/util/shell.rb
146
+ - lib/git-pivotal-tracker-integration/util/story.rb
147
+ - lib/git-pivotal-tracker-integration/util/util.rb
148
+ - lib/git-pivotal-tracker-integration/version-update/gradle.rb
149
+ - lib/git-pivotal-tracker-integration/version-update/version_update.rb
150
+ - lib/git_pivotal_tracker_integration.rb
151
+ - lib/git-pivotal-tracker-integration/command/prepare-commit-msg.sh
89
152
  - bin/git-finish
153
+ - bin/git-release
90
154
  - bin/git-start
155
+ - spec/git-pivotal-tracker-integration/command/base_spec.rb
156
+ - spec/git-pivotal-tracker-integration/command/configuration_spec.rb
157
+ - spec/git-pivotal-tracker-integration/command/finish_spec.rb
158
+ - spec/git-pivotal-tracker-integration/command/release_spec.rb
159
+ - spec/git-pivotal-tracker-integration/command/start_spec.rb
160
+ - spec/git-pivotal-tracker-integration/util/git_spec.rb
161
+ - spec/git-pivotal-tracker-integration/util/shell_spec.rb
162
+ - spec/git-pivotal-tracker-integration/util/story_spec.rb
163
+ - spec/git-pivotal-tracker-integration/version-update/gradle_spec.rb
91
164
  homepage: https://github.com/nebhale/git-pivotal-tracker-integration
92
165
  licenses:
93
166
  - Apache-2.0
@@ -100,7 +173,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
173
  requirements:
101
174
  - - '>='
102
175
  - !ruby/object:Gem::Version
103
- version: 2.0.0
176
+ version: 1.8.7
104
177
  required_rubygems_version: !ruby/object:Gem::Requirement
105
178
  requirements:
106
179
  - - '>='
@@ -112,4 +185,14 @@ rubygems_version: 2.0.0
112
185
  signing_key:
113
186
  specification_version: 4
114
187
  summary: Git commands for integration with Pivotal Tracker
115
- test_files: []
188
+ test_files:
189
+ - spec/git-pivotal-tracker-integration/command/base_spec.rb
190
+ - spec/git-pivotal-tracker-integration/command/configuration_spec.rb
191
+ - spec/git-pivotal-tracker-integration/command/finish_spec.rb
192
+ - spec/git-pivotal-tracker-integration/command/release_spec.rb
193
+ - spec/git-pivotal-tracker-integration/command/start_spec.rb
194
+ - spec/git-pivotal-tracker-integration/util/git_spec.rb
195
+ - spec/git-pivotal-tracker-integration/util/shell_spec.rb
196
+ - spec/git-pivotal-tracker-integration/util/story_spec.rb
197
+ - spec/git-pivotal-tracker-integration/version-update/gradle_spec.rb
198
+ has_rdoc: