v2gpti 1.1.9 → 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 (73) hide show
  1. checksums.yaml +4 -4
  2. data/bin/git-deliver +1 -1
  3. data/bin/git-finish +1 -1
  4. data/bin/git-newbug +1 -1
  5. data/bin/git-newfeature +1 -1
  6. data/bin/git-qa +1 -1
  7. data/bin/git-release +1 -1
  8. data/bin/git-report +1 -1
  9. data/bin/git-start +1 -1
  10. data/bin/git-uat +1 -1
  11. data/config_template +16 -0
  12. data/lib/git-pivotal-tracker-integration/command/base.rb +235 -322
  13. data/lib/git-pivotal-tracker-integration/command/configuration.rb +183 -109
  14. data/lib/git-pivotal-tracker-integration/command/deliver.rb +145 -200
  15. data/lib/git-pivotal-tracker-integration/command/finish.rb +70 -63
  16. data/lib/git-pivotal-tracker-integration/command/newbug.rb +36 -39
  17. data/lib/git-pivotal-tracker-integration/command/newfeature.rb +43 -42
  18. data/lib/git-pivotal-tracker-integration/command/release.rb +171 -203
  19. data/lib/git-pivotal-tracker-integration/command/report.rb +33 -36
  20. data/lib/git-pivotal-tracker-integration/command/start.rb +74 -78
  21. data/lib/git-pivotal-tracker-integration/util/git.rb +202 -204
  22. data/lib/git-pivotal-tracker-integration/util/shell.rb +19 -16
  23. data/lib/git-pivotal-tracker-integration/util/story.rb +155 -177
  24. data/lib/git-pivotal-tracker-integration/version-update/gradle.rb +44 -40
  25. data/lib/git-pivotal-tracker-integration.rb +44 -0
  26. data/spec/git-pivotal-tracker-integration/command/configuration_spec.rb +1 -2
  27. data/spec/git-pivotal-tracker-integration/command/finish_spec.rb +1 -1
  28. data/spec/git-pivotal-tracker-integration/command/release_spec.rb +1 -1
  29. data/spec/git-pivotal-tracker-integration/command/start_spec.rb +1 -1
  30. data/spec/git-pivotal-tracker-integration/util/story_spec.rb +21 -32
  31. data/tracker_api/lib/tracker_api/client.rb +241 -0
  32. data/tracker_api/lib/tracker_api/endpoints/activity.rb +38 -0
  33. data/tracker_api/lib/tracker_api/endpoints/comments.rb +27 -0
  34. data/tracker_api/lib/tracker_api/endpoints/epic.rb +17 -0
  35. data/tracker_api/lib/tracker_api/endpoints/epics.rb +20 -0
  36. data/tracker_api/lib/tracker_api/endpoints/file_attachment.rb +18 -0
  37. data/tracker_api/lib/tracker_api/endpoints/iterations.rb +20 -0
  38. data/tracker_api/lib/tracker_api/endpoints/me.rb +17 -0
  39. data/tracker_api/lib/tracker_api/endpoints/memberships.rb +20 -0
  40. data/tracker_api/lib/tracker_api/endpoints/notifications.rb +20 -0
  41. data/tracker_api/lib/tracker_api/endpoints/project.rb +17 -0
  42. data/tracker_api/lib/tracker_api/endpoints/projects.rb +18 -0
  43. data/tracker_api/lib/tracker_api/endpoints/stories.rb +20 -0
  44. data/tracker_api/lib/tracker_api/endpoints/story.rb +37 -0
  45. data/tracker_api/lib/tracker_api/endpoints/tasks.rb +20 -0
  46. data/tracker_api/lib/tracker_api/error.rb +18 -0
  47. data/tracker_api/lib/tracker_api/logger.rb +31 -0
  48. data/tracker_api/lib/tracker_api/resources/account.rb +18 -0
  49. data/tracker_api/lib/tracker_api/resources/activity.rb +24 -0
  50. data/tracker_api/lib/tracker_api/resources/base.rb +71 -0
  51. data/tracker_api/lib/tracker_api/resources/change.rb +15 -0
  52. data/tracker_api/lib/tracker_api/resources/comment.rb +20 -0
  53. data/tracker_api/lib/tracker_api/resources/epic.rb +17 -0
  54. data/tracker_api/lib/tracker_api/resources/file_attachment.rb +23 -0
  55. data/tracker_api/lib/tracker_api/resources/iteration.rb +24 -0
  56. data/tracker_api/lib/tracker_api/resources/label.rb +14 -0
  57. data/tracker_api/lib/tracker_api/resources/me.rb +21 -0
  58. data/tracker_api/lib/tracker_api/resources/membership_summary.rb +15 -0
  59. data/tracker_api/lib/tracker_api/resources/notification.rb +26 -0
  60. data/tracker_api/lib/tracker_api/resources/person.rb +14 -0
  61. data/tracker_api/lib/tracker_api/resources/primary_resource.rb +13 -0
  62. data/tracker_api/lib/tracker_api/resources/project.rb +131 -0
  63. data/tracker_api/lib/tracker_api/resources/project_membership.rb +16 -0
  64. data/tracker_api/lib/tracker_api/resources/story.rb +102 -0
  65. data/tracker_api/lib/tracker_api/resources/task.rb +16 -0
  66. data/tracker_api/lib/tracker_api/resources/time_zone.rb +13 -0
  67. data/tracker_api/lib/tracker_api/version.rb +3 -0
  68. data/tracker_api/lib/tracker_api.rb +60 -0
  69. metadata +202 -53
  70. data/lib/git-pivotal-tracker-integration/command/command.rb +0 -20
  71. data/lib/git-pivotal-tracker-integration/util/util.rb +0 -20
  72. data/lib/git-pivotal-tracker-integration/version-update/version_update.rb +0 -20
  73. data/lib/git_pivotal_tracker_integration.rb +0 -18
@@ -13,24 +13,27 @@
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/util'
16
+ module GitPivotalTrackerIntegration
17
+ module Util
17
18
 
18
- # Utilities for dealing with the shell
19
- class GitPivotalTrackerIntegration::Util::Shell
19
+ # Utilities for dealing with the shell
20
+ class Shell
20
21
 
21
- # Executes a command
22
- #
23
- # @param [String] command the command to execute
24
- # @param [Boolean] abort_on_failure whether to +Kernel#abort+ with +FAIL+ as
25
- # the message when the command's +Status#existstatus+ is not +0+
26
- # @return [String] the result of the command
27
- def self.exec(command, abort_on_failure = true)
28
- result = `#{command}`
29
- if $?.exitstatus != 0 && abort_on_failure
30
- abort "FAIL on command:#{command}"
31
- end
22
+ # Executes a command
23
+ #
24
+ # @param [String] command the command to execute
25
+ # @param [Boolean] abort_on_failure whether to +Kernel#abort+ with +FAIL+ as
26
+ # the message when the command's +Status#existstatus+ is not +0+
27
+ # @return [String] the result of the command
28
+ def self.exec(command, abort_on_failure = true)
29
+ result = `#{command}`
30
+ if $?.exitstatus != 0 && abort_on_failure
31
+ abort "FAIL on command:#{command}"
32
+ end
32
33
 
33
- result
34
- end
34
+ result
35
+ end
35
36
 
37
+ end
38
+ end
36
39
  end
@@ -13,219 +13,197 @@
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/util'
17
- require 'highline/import'
18
- require 'pivotal-tracker'
19
-
20
- # Utilities for dealing with +PivotalTracker::Story+s
21
- class GitPivotalTrackerIntegration::Util::Story
22
-
23
- # Print a human readable version of a story. This pretty prints the title,
24
- # description, and notes for the story.
25
- #
26
- # @param [PivotalTracker::Story] story the story to pretty print
27
- # @return [void]
28
- def self.pretty_print(story)
29
- print_label LABEL_TITLE
30
- print_value story.name
31
-
32
- description = story.description
33
- if !description.nil? && !description.empty?
34
- print_label 'Description'
35
- print_value description
36
- end
37
-
38
- PivotalTracker::Note.all(story).sort_by { |note| note.noted_at }.each_with_index do |note, index|
39
- print_label "Note #{index + 1}"
40
- print_value note.text
41
- end
42
-
43
- puts
44
- end
16
+ module GitPivotalTrackerIntegration
17
+ module Util
18
+
19
+ # Utilities for dealing with +PivotalTracker::Story+s
20
+ class Story
21
+
22
+ CANDIDATE_STATES = %w(rejected unstarted unscheduled).freeze
23
+ LABEL_DESCRIPTION = 'Description'.freeze
24
+ LABEL_TITLE = 'Title'.freeze
25
+ LABEL_WIDTH = (LABEL_DESCRIPTION.length + 2).freeze
26
+ CONTENT_WIDTH = (HighLine.new.output_cols - LABEL_WIDTH).freeze
27
+
28
+ # Print a human readable version of a story. This pretty prints the title,
29
+ # description, and notes for the story.
30
+ #
31
+ # @param [PivotalTracker::Story] story the story to pretty print
32
+ # @return [void]
33
+ def self.pretty_print(story)
34
+ print_label LABEL_TITLE
35
+ print_value story.name
36
+
37
+ description = story.description
38
+ if !description.nil? && !description.empty?
39
+ print_label 'Description'
40
+ print_value description
41
+ end
45
42
 
43
+ story.comments.sort_by{ |comment| comment.updated_at }.each_with_index do |comment, index|
44
+ print_label "Note #{index + 1}"
45
+ print_value comment.text
46
+ end
46
47
 
47
- # Selects a Pivotal Tracker story by doing the following steps:
48
- #
49
- # @param [PivotalTracker::Project] project the project to select stories from
50
- # @param [String, nil] filter a filter for selecting the story to start. This
51
- # filter can be either:
52
- # * a story id: selects the story represented by the id
53
- # * a story type (feature, bug, chore): offers the user a selection of stories of the given type
54
- # * +nil+: offers the user a selection of stories of all types
55
- # @param [Fixnum] limit The number maximum number of stories the user can choose from
56
- # @return [PivotalTracker::Story] The Pivotal Tracker story selected by the user
57
- def self.select_story(project, filter = nil, limit = 12)
58
- if filter =~ /[[:digit:]]/
59
- story = project.stories.find filter.to_i
60
- else
61
- story = find_story project, filter, limit
62
- end
48
+ puts
49
+ end
63
50
 
64
- story
65
- end
66
51
 
67
- def self.select_release(project, filter = 'b', limit = 10)
68
- if filter =~ /[[:digit:]]/
69
- story = project.stories.find filter.to_i
70
- if story.(story_type != "release")
52
+ # Selects a Pivotal Tracker story by doing the following steps:
53
+ #
54
+ # @param [PivotalTracker::Project] project the project to select stories from
55
+ # @param [String, nil] filter a filter for selecting the story to start. This
56
+ # filter can be either:
57
+ # * a story id: selects the story represented by the id
58
+ # * a story type (feature, bug, chore): offers the user a selection of stories of the given type
59
+ # * +nil+: offers the user a selection of stories of all types
60
+ # @param [Fixnum] limit The number maximum number of stories the user can choose from
61
+ # @return [PivotalTracker::Story] The Pivotal Tracker story selected by the user
62
+ def self.select_story(project, filter = nil, limit = 5)
71
63
  story = nil
72
- $LOG.fatal("Specified story##{filter} is not a valid release story")
73
- puts "Specified story##{filter} is not a valid release story"
74
- abort 'FAIL'
75
- end
76
- else
77
- story = find_story project, filter, limit
78
- end
79
64
 
80
- story
81
- end
82
-
83
- private
65
+ if filter =~ /[[:digit:]]/
66
+ story = project.story filter.to_i
67
+ else
68
+ # story type from (feature, bug, chore)
69
+ # state from (rejected unstarted unscheduled)
70
+ # if story type is "feature", then retrieve only estimated ones.
71
+ criteria = "current_state:#{CANDIDATE_STATES.join(',')}"
72
+
73
+ if %w(feature bug chore).include?(filter)
74
+ criteria << " type:#{filter}"
75
+ criteria << " -estimate:-1" if filter == "feature"
76
+ else
77
+ criteria << " type:feature,bug,chore"
78
+ end
84
79
 
85
- CANDIDATE_STATES = %w(rejected unstarted unscheduled).freeze
80
+ candidates = project.stories(filter: criteria, limit: limit)
81
+ #limit is not working as expected. Need to find the reason. For now handle via ruby
82
+ candidates = candidates[0...5]
83
+ story = choose_story(candidates) unless candidates.empty?
84
+ end
86
85
 
87
- LABEL_DESCRIPTION = 'Description'.freeze
86
+ story
87
+ end
88
88
 
89
- LABEL_TITLE = 'Title'.freeze
89
+ def self.select_release(project, filter = 'b', limit = 10)
90
+ if filter =~ /[[:digit:]]/
91
+ story = project.story filter.to_i
92
+ if story.story_type != "release"
93
+ $LOG.fatal("Specified story##{filter} is not a valid release story")
94
+ puts "Specified story##{filter} is not a valid release story"
95
+ abort 'FAIL'
96
+ end
97
+ else
98
+ story = find_release_story project, filter, limit
99
+ end
90
100
 
91
- LABEL_WIDTH = (LABEL_DESCRIPTION.length + 2).freeze
101
+ story
102
+ end
92
103
 
93
- CONTENT_WIDTH = (HighLine.new.output_cols - LABEL_WIDTH).freeze
104
+ private
94
105
 
95
- def self.print_label(label)
96
- print "%#{LABEL_WIDTH}s" % ["#{label}: "]
97
- end
106
+ def self.print_label(label)
107
+ print "%#{LABEL_WIDTH}s" % ["#{label}: "]
108
+ end
98
109
 
99
- def self.print_value(value)
100
- if value.nil? || value.empty?
101
- puts ''
102
- else
103
- value.scan(/\S.{0,#{CONTENT_WIDTH - 2}}\S(?=\s|$)|\S+/).each_with_index do |line, index|
104
- if index == 0
105
- puts line
110
+ def self.print_value(value)
111
+ if value.nil? || value.empty?
112
+ puts ''
106
113
  else
107
- puts "%#{LABEL_WIDTH}s%s" % ['', line]
114
+ value.scan(/\S.{0,#{CONTENT_WIDTH - 2}}\S(?=\s|$)|\S+/).each_with_index do |line, index|
115
+ if index == 0
116
+ puts line
117
+ else
118
+ puts "%#{LABEL_WIDTH}s%s" % ['', line]
119
+ end
120
+ end
108
121
  end
109
122
  end
110
- end
111
- end
112
-
113
- def self.find_story(project, type, limit)
114
- if (type == "b" || type == "v")
115
- release_type = type
116
- type = "release"
117
- end
118
- criteria = {
119
- :current_state => CANDIDATE_STATES,
120
- :limit => limit
121
- }
122
- if type
123
- criteria[:story_type] = type
124
- end
125
123
 
126
- candidates = project.stories.all criteria
124
+ def self.choose_story(candidates, type = nil)
125
+ choose do |menu|
126
+ puts "\nUnestimated features can not be started.\n\n" if type != "release"
127
127
 
128
- # only include stories that have been estimated
129
- estimated_candidates = Array.new
130
- val_is_valid = true
128
+ menu.prompt = 'Choose a story to start: '
131
129
 
132
- candidates.each {|val|
133
- val_is_valid = true
134
- if (val.story_type == "feature" )
135
- # puts "#{val.story_type} #{val.name}.estimate:#{val.estimate} "
136
- if (val.estimate < 0)
137
- # puts "#{val.estimate} < 0"
138
- val_is_valid = false
130
+ candidates.each do |story|
131
+ name = type ? story.name : '%-7s %s' % [story.story_type.upcase, story.name]
132
+ menu.choice(name) { story }
139
133
  end
140
- elsif (val.story_type == "release")
141
- label_string = val.labels
142
- if label_string.nil?
143
- label_string = "";
144
- end
145
- if (val.name[0] != release_type) || (label_string.include? val.name)
146
- val_is_valid = false
134
+ menu.choice('Quit') do
135
+ say "Thank you for using v2gpti"
136
+ exit 0
147
137
  end
148
138
  end
139
+ end
149
140
 
150
- if val_is_valid
151
- # puts "val_is_valid:#{val_is_valid}"
152
- estimated_candidates << val
153
- end
154
- }
155
- candidates = estimated_candidates
141
+ # story type is release with story name starting with "v"/"b" or story labels includes story name.
142
+ # state from (rejected unstarted unscheduled)
143
+ # sort stories based on version (version number part of the story name) and pick the latest one.
144
+ def self.find_release_story(project, type, limit)
145
+ release_type = (type == "b") ? "build" : "version"
156
146
 
157
- if candidates.length != 0
158
- story = choose do |menu|
159
- if type != "release"
160
- puts "\nUnestimated features can not be started.\n\n"
161
- end
147
+ criteria = "type:release"
148
+ criteria << " current_state:#{CANDIDATE_STATES.join(',')}"
149
+ criteria << " name:/#{type}*/" #story name starts with b or v
162
150
 
163
- menu.prompt = 'Choose a story to start: '
151
+ candidates = project.stories(filter: criteria, limit: limit)
164
152
 
165
- candidates.each do |story|
166
- name = type ? story.name : '%-7s %s' % [story.story_type.upcase, story.name]
167
- menu.choice(name) { story }
153
+ candidates = candidates.select do |story|
154
+ labels = story.labels.map(&:name)
155
+ !labels.include?(story.name)
168
156
  end
169
- menu.choice('Quit') do
170
- say "Thank you for using v2gpti"
171
- exit 0
157
+
158
+ unless candidates.empty?
159
+ story = choose_story(candidates, "release")
160
+ else
161
+ puts "There are no available release stories."
162
+ last_release = last_release_story(project, type)
163
+
164
+ if last_release
165
+ puts " The last #{release_type} release was #{last_release.name}."
166
+ next_release_number = set_next_release_number(last_release, release_type)
167
+ else
168
+ next_release_number = ask("To create a new #{release_type}, enter a name for the new release story:")
169
+ end
170
+ puts "New #{release_type} release number is: #{next_release_number}"
171
+ story = self.create_new_release(project, next_release_number)
172
172
  end
173
- end
174
173
 
175
- puts
176
- else
177
- if type == "release"
178
- last_release = last_release_story(project, release_type)
179
- last_release_number = last_release.name if !last_release.nil?
180
- last_release_type_string = (release_type == "b") ? "build" : "version"
181
- puts "There are no available release stories."
182
- puts " The last #{last_release_type_string} release was #{last_release_number}." if !last_release.nil?
183
- next_release_number = set_next_release_number(last_release, release_type, last_release_number) if !last_release.nil?
184
- next_release_number = ask("To create a new #{last_release_type_string}, enter a name for the new release story:") if last_release.nil?
185
- puts "New #{last_release_type_string} release number is: #{next_release_number}"
186
- story = self.create_new_release(project, next_release_number)
187
- else
188
- puts
174
+ story
189
175
  end
190
- end
191
176
 
177
+ # sort stories based on version (version number part of the story name) and pick the latest one.
178
+ def self.last_release_story (project, type)
192
179
 
180
+ candidates = project.stories filter: "type:release name:/#{type}*/"
181
+ candidates = candidates.select do |story|
182
+ labels = story.labels.map(&:name)
183
+ !labels.include?(story.name)
184
+ end
185
+ candidates.sort! { |x,y| Gem::Version.new(y.name[1 .. -1]) <=> Gem::Version.new(x.name[1 .. -1]) }
193
186
 
194
- story
195
- end
187
+ candidates.first
188
+ end
196
189
 
197
- def self.last_release_story (project, release_type)
198
- criteria = {
199
- :story_type => "release"
200
- }
190
+ def self.set_next_release_number(last_release, release_type)
191
+ if release_type == "b"
192
+ return last_release.name.next # just increment the last number
193
+ end
194
+ if release_type == "v"
195
+ version_split = last_release.name.split(/\./)
196
+ last_incremented_number=version_split.last.next
197
+ version_split.pop
198
+ version_split.push(last_incremented_number)
199
+ return version_split.join(".")
200
+ end
201
+ end
201
202
 
202
- candidates = project.stories.all criteria
203
- candidates = candidates.select {|x| (x.name[0]==release_type) && !(x.labels.nil? || (!x.labels.include? x.name))}
204
- candidates.sort! { |x,y| Gem::Version.new(y.name[1 .. -1]) <=> Gem::Version.new(x.name[1 .. -1]) }
203
+ def self.create_new_release (project, next_release_number)
204
+ project.create_story(:story_type => 'release', :current_state => 'unstarted', :name => next_release_number)
205
+ end
205
206
 
206
- candidates.first
207
- end
208
-
209
- def self.set_next_release_number(last_release, release_type, last_release_number)
210
- if release_type == "b"
211
- return last_release_number.next
212
- end
213
- if release_type == "v"
214
- version_split = last_release_number.split(/\./)
215
- last_incremented_number=version_split.last.next
216
- version_split.pop
217
- version_split.push(last_incremented_number)
218
- return version_split.join(".")
219
207
  end
220
208
  end
221
-
222
- def self.create_new_release (project, next_release_number)
223
- new_story = PivotalTracker::Story.new
224
- new_story.project_id = project.id
225
- new_story.story_type = "release"
226
- new_story.current_state = "unstarted"
227
- new_story.name = next_release_number
228
-
229
- uploaded_story = new_story.create
230
- end
231
209
  end
@@ -13,52 +13,56 @@
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/version-update/version_update'
16
+ module GitPivotalTrackerIntegration
17
+ module VersionUpdate
17
18
 
18
- # A version updater for dealing with _typical_ Gradle projects. This updater
19
- # assumes that the version of the current project is stored within a
20
- # +gradle.properties+ file in the root of the repository. This properties
21
- # file should have an entry with a key of +version+ and version number as the key.
22
- class GitPivotalTrackerIntegration::VersionUpdate::Gradle
19
+ # A version updater for dealing with _typical_ Gradle projects. This updater
20
+ # assumes that the version of the current project is stored within a
21
+ # +gradle.properties+ file in the root of the repository. This properties
22
+ # file should have an entry with a key of +version+ and version number as the key.
23
+ class Gradle
23
24
 
24
- # Creates an instance of this updater
25
- #
26
- # @param [String] root The root of the repository
27
- def initialize(root)
28
- @gradle_properties = File.expand_path 'gradle.properties', root
25
+ # Creates an instance of this updater
26
+ #
27
+ # @param [String] root The root of the repository
28
+ def initialize(root)
29
+ @gradle_file = File.expand_path 'app/build.gradle', root
30
+ end
29
31
 
30
- if File.exist? @gradle_properties
31
- groups = nil
32
- File.open(@gradle_properties, 'r') do |file|
33
- groups = file.read().scan(/version[=:](.*)/)
32
+ # Update the version of the project
33
+ #
34
+ # @param [String] new_version the version to update the project to
35
+ # @return [void]
36
+ def update_dev_version(new_version)
37
+ update_version('DEV', 'SNAPSHOT', new_version)
34
38
  end
35
- @version = groups[0] ? groups[0][0]: nil
36
- end
37
- end
38
39
 
39
- # Whether this updater supports updating this project
40
- #
41
- # @return [Boolean] +true+ if a valid version number was found on
42
- # initialization, +false+ otherwise
43
- def supports?
44
- !@version.nil?
45
- end
40
+ def update_qa_version(new_version)
41
+ update_version('QA', 'SNAPSHOT', new_version)
42
+ end
46
43
 
47
- # The current version of the project
48
- #
49
- # @return [String] the current version of the project
50
- def current_version
51
- @version
52
- end
44
+ def update_uat_version(new_version)
45
+ update_version('UAT', new_version, new_version)
46
+ end
53
47
 
54
- # Update the version of the project
55
- #
56
- # @param [String] new_version the version to update the project to
57
- # @return [void]
58
- def update_version(new_version)
59
- contents = File.read(@gradle_properties)
60
- contents = contents.gsub(/(version[=:])#{@version}/, "\\1#{new_version}")
61
- File.open(@gradle_properties, 'w') { |file| file.write(contents) }
62
- end
48
+ def update_prod_version(new_version)
49
+ update_version('PROD', new_version, new_version)
50
+ end
51
+
52
+ private
53
+
54
+ def update_version(version_type, new_name, new_version)
55
+ content = File.read(@gradle_file)
56
+ new_content = content.gsub(/productFlavors.*?#{version_type}.*?versionCode( )*=?( )*(.*?)versionName( )*=?( )*(.*?\s)/m) do |match|
57
+ version_code = $3.strip
58
+ version_name = $6.strip
59
+ match.gsub(version_code, new_version).gsub(version_name, "\"#{new_name}\"")
60
+ end
61
+
62
+ File.open(@gradle_file, 'w') { |file| file.write(new_content) }
63
+ end
64
+
65
+ end
63
66
 
67
+ end
64
68
  end
@@ -0,0 +1,44 @@
1
+
2
+ # dependencies
3
+ require 'rubygems'
4
+ require 'fileutils'
5
+ require 'time'
6
+ require 'highline/import'
7
+ require 'parseconfig'
8
+ require 'logger'
9
+ require 'os'
10
+
11
+ ROOT_PATH = File.dirname(File.expand_path(__FILE__))
12
+ TRACKER_API_HOME = "#{ROOT_PATH}/../tracker_api"
13
+
14
+ $LOAD_PATH << "#{TRACKER_API_HOME}/lib"
15
+
16
+ require "#{TRACKER_API_HOME}/lib/tracker_api"
17
+
18
+
19
+ module GitPivotalTrackerIntegration
20
+ module Command
21
+ autoload :Base, 'git-pivotal-tracker-integration/command/base'
22
+ autoload :Configuration, 'git-pivotal-tracker-integration/command/configuration'
23
+ autoload :Deliver, 'git-pivotal-tracker-integration/command/deliver'
24
+ autoload :Finish, 'git-pivotal-tracker-integration/command/finish'
25
+ autoload :Newbug, 'git-pivotal-tracker-integration/command/newbug'
26
+ autoload :Newfeature, 'git-pivotal-tracker-integration/command/newfeature'
27
+ autoload :Release, 'git-pivotal-tracker-integration/command/release'
28
+ autoload :Report, 'git-pivotal-tracker-integration/command/report'
29
+ autoload :Start, 'git-pivotal-tracker-integration/command/start'
30
+ end
31
+
32
+ module Util
33
+ autoload :Git, 'git-pivotal-tracker-integration/util/git'
34
+ autoload :Shell, 'git-pivotal-tracker-integration/util/shell'
35
+ autoload :Story, 'git-pivotal-tracker-integration/util/story'
36
+ end
37
+
38
+ module VersionUpdate
39
+ autoload :Gradle, 'git-pivotal-tracker-integration/version-update/gradle'
40
+ end
41
+ end
42
+
43
+ autoload :Toggl, 'git-pivotal-tracker-integration/util/togglV8'
44
+ autoload :TogglException, 'git-pivotal-tracker-integration/util/togglV8'
@@ -16,7 +16,6 @@
16
16
  require 'spec_helper'
17
17
  require 'git-pivotal-tracker-integration/command/configuration'
18
18
  require 'git-pivotal-tracker-integration/util/git'
19
- require 'pivotal-tracker'
20
19
 
21
20
  describe GitPivotalTrackerIntegration::Command::Configuration do
22
21
 
@@ -37,7 +36,7 @@ describe GitPivotalTrackerIntegration::Command::Configuration do
37
36
  it 'should prompt the user for the API token if it is not configured' do
38
37
  GitPivotalTrackerIntegration::Util::Git.should_receive(:get_config).with('pivotal.api-token', :inherited).and_return('')
39
38
  @configuration.should_receive(:ask).and_return('test_api_token')
40
- GitPivotalTrackerIntegration::Util::Git.should_receive(:set_config).with("pivotal.project-id", anything())
39
+ GitPivotalTrackerIntegration::Util::Git.should_receive(:set_config).with("pivotal.project-id", anything())
41
40
  GitPivotalTrackerIntegration::Util::Git.should_receive(:set_config).with('pivotal.api-token', 'test_api_token', :global)
42
41
 
43
42
  api_token = @configuration.api_token
@@ -17,7 +17,7 @@ require 'spec_helper'
17
17
  require 'git-pivotal-tracker-integration/command/configuration'
18
18
  require 'git-pivotal-tracker-integration/command/finish'
19
19
  require 'git-pivotal-tracker-integration/util/git'
20
- require 'pivotal-tracker'
20
+
21
21
 
22
22
  describe GitPivotalTrackerIntegration::Command::Finish do
23
23
 
@@ -18,7 +18,7 @@ require 'git-pivotal-tracker-integration/command/configuration'
18
18
  require 'git-pivotal-tracker-integration/command/release'
19
19
  require 'git-pivotal-tracker-integration/util/git'
20
20
  require 'git-pivotal-tracker-integration/util/story'
21
- require 'pivotal-tracker'
21
+
22
22
 
23
23
  describe GitPivotalTrackerIntegration::Command::Release do
24
24
 
@@ -18,7 +18,7 @@ require 'git-pivotal-tracker-integration/command/configuration'
18
18
  require 'git-pivotal-tracker-integration/command/start'
19
19
  require 'git-pivotal-tracker-integration/util/git'
20
20
  require 'git-pivotal-tracker-integration/util/story'
21
- require 'pivotal-tracker'
21
+
22
22
 
23
23
  describe GitPivotalTrackerIntegration::Command::Start do
24
24