v2gpti 1.2.3 → 1.2.4
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.
- checksums.yaml +4 -4
- data/lib/git-pivotal-tracker-integration/command/base.rb +1 -1
- data/lib/git-pivotal-tracker-integration/command/deliver.rb +1 -4
- data/lib/git-pivotal-tracker-integration/command/finish.rb +2 -4
- data/lib/git-pivotal-tracker-integration/command/release.rb +5 -17
- data/lib/git-pivotal-tracker-integration/util/story.rb +8 -3
- data/lib/git-pivotal-tracker-integration/version-update/gradle.rb +20 -10
- data/tracker_api/lib/tracker_api/client.rb +27 -8
- data/tracker_api/lib/tracker_api/endpoints/project.rb +17 -0
- data/tracker_api/lib/tracker_api/endpoints/story.rb +5 -0
- data/tracker_api/lib/tracker_api/resources/story.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0f97f1aaf9f5ee155d01d98bfcbbf723c3f0198
|
4
|
+
data.tar.gz: ca83cbe5cb66c8e31f2a5a20088ef81ac3e8ca86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 878a17d45ab81f5c5df7945e808370e482458c196e1275ddc8229424ad5ba11283f49b2e776337de2053bd194fce4c60cad5a07d609e74a5a06e95d59fc09b32
|
7
|
+
data.tar.gz: 763d6993ac3777fbdb8b815ffa883229242e875816c2b85edba7a3c3c08fa9cb9e0fdc9713fa591c698c4e28c6ff069166e840a011c05cbb086ad9196ba30cac
|
@@ -43,7 +43,7 @@ module GitPivotalTrackerIntegration
|
|
43
43
|
@configuration.check_for_config_file
|
44
44
|
@configuration.check_for_config_contents
|
45
45
|
|
46
|
-
@client = TrackerApi::Client.new(:token => @configuration.api_token)
|
46
|
+
@client = TrackerApi::Client.new(:token => @configuration.api_token, :logger => Logger.new('faraday.log'))
|
47
47
|
@platform = @configuration.platform_name
|
48
48
|
|
49
49
|
current_project_id = @configuration.project_id.to_i
|
@@ -113,11 +113,8 @@ module GitPivotalTrackerIntegration
|
|
113
113
|
all_stories << build_story
|
114
114
|
|
115
115
|
all_stories.each do |story|
|
116
|
-
labels = story.labels.map(&:name)
|
117
|
-
labels << build_story.name
|
118
|
-
labels.uniq!
|
119
116
|
|
120
|
-
story.
|
117
|
+
story.add_label(build_story.name)
|
121
118
|
|
122
119
|
case story.story_type
|
123
120
|
when 'feature', 'bug'
|
@@ -56,9 +56,7 @@ module GitPivotalTrackerIntegration
|
|
56
56
|
Util::Git.merge(@configuration.story(@project), no_complete)
|
57
57
|
Util::Git.push Util::Git.branch_name
|
58
58
|
|
59
|
-
|
60
|
-
labels << "Need code review"
|
61
|
-
story.add_labels(*labels)
|
59
|
+
story.add_label('Need code review')
|
62
60
|
end
|
63
61
|
|
64
62
|
|
@@ -87,7 +85,7 @@ module GitPivotalTrackerIntegration
|
|
87
85
|
|
88
86
|
# cd back to the working_directory
|
89
87
|
Dir.chdir(working_directory)
|
90
|
-
elsif @platform == 'android'
|
88
|
+
elsif @platform.downcase == 'android'
|
91
89
|
updater = VersionUpdate::Gradle.new(@repository_root)
|
92
90
|
updater.update_dev_version(build_number)
|
93
91
|
end
|
@@ -118,10 +118,7 @@ module GitPivotalTrackerIntegration
|
|
118
118
|
puts Util::Shell.exec "git checkout #{current_branch}"
|
119
119
|
|
120
120
|
#add story name as one of the labels for the story
|
121
|
-
|
122
|
-
labels << story.name unless labels.include?(story.name)
|
123
|
-
puts "labels: #{labels.join(', ')}"
|
124
|
-
story.add_labels(*labels) unless labels.include?(story.name)
|
121
|
+
story.add_label(story.name)
|
125
122
|
|
126
123
|
i_stories = included_stories @project, story
|
127
124
|
add_version_tag_to_stories i_stories, story
|
@@ -134,19 +131,10 @@ module GitPivotalTrackerIntegration
|
|
134
131
|
all_stories = stories.dup
|
135
132
|
all_stories << release_story
|
136
133
|
puts "Included stories:\n"
|
137
|
-
all_stories.each
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
labels.uniq!
|
142
|
-
|
143
|
-
unless origin_labels.empty?
|
144
|
-
if origin_labels.to_s.scan(/b\d{1}/).size > origin_labels.to_s.scan(/v\d{1}/).size
|
145
|
-
story.add_labels(*labels)
|
146
|
-
puts "#{story.id} - #{story.name}"
|
147
|
-
end
|
148
|
-
end
|
149
|
-
}
|
134
|
+
all_stories.each do |story|
|
135
|
+
story.add_label(release_story.name)
|
136
|
+
puts "#{story.id} - #{story.name}"
|
137
|
+
end
|
150
138
|
end
|
151
139
|
|
152
140
|
def included_stories(project, release_story)
|
@@ -68,7 +68,7 @@ module GitPivotalTrackerIntegration
|
|
68
68
|
# story type from (feature, bug, chore)
|
69
69
|
# state from (rejected unstarted unscheduled)
|
70
70
|
# if story type is "feature", then retrieve only estimated ones.
|
71
|
-
criteria = " state:unstarted,rejected,unscheduled"
|
71
|
+
criteria = " state:unstarted,rejected,unscheduled,planned"
|
72
72
|
|
73
73
|
if %w(feature bug chore).include?(filter)
|
74
74
|
criteria << " type:#{filter}"
|
@@ -145,7 +145,7 @@ module GitPivotalTrackerIntegration
|
|
145
145
|
release_type = (type == "b") ? "build" : "version"
|
146
146
|
|
147
147
|
criteria = "type:release"
|
148
|
-
criteria << " state:unstarted,rejected,
|
148
|
+
criteria << " state:unstarted,rejected,planned"
|
149
149
|
criteria << " name:/#{type}*/" #story name starts with b or v
|
150
150
|
|
151
151
|
candidates = project.stories(filter: criteria, limit: limit)
|
@@ -163,10 +163,15 @@ module GitPivotalTrackerIntegration
|
|
163
163
|
|
164
164
|
if last_release
|
165
165
|
puts " The last #{release_type} release was #{last_release.name}."
|
166
|
-
|
166
|
+
if release_type == "version"
|
167
|
+
next_release_number = ask("To create a new #{release_type}, enter a name for the new release story:")
|
168
|
+
else
|
169
|
+
next_release_number = set_next_release_number(last_release, release_type)
|
170
|
+
end
|
167
171
|
else
|
168
172
|
next_release_number = ask("To create a new #{release_type}, enter a name for the new release story:")
|
169
173
|
end
|
174
|
+
|
170
175
|
puts "New #{release_type} release number is: #{next_release_number}"
|
171
176
|
story = self.create_new_release(project, next_release_number)
|
172
177
|
end
|
@@ -34,34 +34,44 @@ module GitPivotalTrackerIntegration
|
|
34
34
|
# @param [String] new_version the version to update the project to
|
35
35
|
# @return [void]
|
36
36
|
def update_dev_version(new_version)
|
37
|
-
|
37
|
+
update_version_in_sec('DEV', new_version, 'SNAPSHOT')
|
38
38
|
end
|
39
39
|
|
40
40
|
def update_qa_version(new_version)
|
41
|
-
|
41
|
+
update_version_in_sec('QA', new_version, 'SNAPSHOT')
|
42
42
|
end
|
43
43
|
|
44
44
|
def update_uat_version(new_version)
|
45
|
-
|
45
|
+
update_version_in_sec('UAT', qa_version_code, new_version)
|
46
46
|
end
|
47
47
|
|
48
48
|
def update_prod_version(new_version)
|
49
|
-
|
49
|
+
update_version_in_sec('PROD', qa_version_code, new_version)
|
50
50
|
end
|
51
51
|
|
52
52
|
private
|
53
53
|
|
54
|
-
def
|
54
|
+
def update_version_in_sec(section, new_code, new_version)
|
55
55
|
content = File.read(@gradle_file)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
match.gsub(version_code, new_version).gsub(version_name, "\"#{new_name}\"")
|
60
|
-
end
|
56
|
+
|
57
|
+
new_content = update_version(content, section, 'Code', new_code) #update versionCode
|
58
|
+
new_content = update_version(new_content, section, 'Name', "\"#{new_version}\"") #update versionName
|
61
59
|
|
62
60
|
File.open(@gradle_file, 'w') { |file| file.write(new_content) }
|
63
61
|
end
|
64
62
|
|
63
|
+
def qa_version_code
|
64
|
+
content = File.read(@gradle_file)
|
65
|
+
match = content.match(/productFlavors.*?QA.*?versionCode( )*=?( )*(.*?\s)/m)
|
66
|
+
match[3].strip
|
67
|
+
end
|
68
|
+
|
69
|
+
def update_version(file_content, section, type, new_value)
|
70
|
+
file_content.gsub(/productFlavors.*?#{section}.*?version#{type}( )*=?( )*(.*?\s)/m) do |match|
|
71
|
+
match.gsub($3.strip, new_value)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
65
75
|
end
|
66
76
|
|
67
77
|
end
|
@@ -72,6 +72,15 @@ module TrackerApi
|
|
72
72
|
request(:put, parse_query_and_convenience_headers(path, options))
|
73
73
|
end
|
74
74
|
|
75
|
+
# Make a HTTP DELETE request
|
76
|
+
#
|
77
|
+
# @param path [String] The path, relative to api endpoint
|
78
|
+
# @param options [Hash] Query and header params for request
|
79
|
+
# @return [Faraday::Response]
|
80
|
+
def delete(path, options = {})
|
81
|
+
request(:delete, parse_query_and_convenience_headers(path, options))
|
82
|
+
end
|
83
|
+
|
75
84
|
# Make one or more HTTP GET requests, optionally fetching
|
76
85
|
# the next page of results from information passed back in headers
|
77
86
|
# based on value in {#auto_paginate}.
|
@@ -193,15 +202,25 @@ module TrackerApi
|
|
193
202
|
params = {}
|
194
203
|
end
|
195
204
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
205
|
+
response = nil
|
206
|
+
sleep 0.5 # Per PT we might be hitting their API too frequently. So adding a 0.5 Sec pause.
|
207
|
+
begin
|
208
|
+
tries ||= 3
|
209
|
+
@last_response = response = connection.send(method) do |req|
|
210
|
+
req.url(url)
|
211
|
+
req.headers.merge!(headers)
|
212
|
+
req.params.merge!(params)
|
213
|
+
req.body = body
|
214
|
+
end
|
215
|
+
response
|
216
|
+
|
217
|
+
rescue Faraday::Error::ClientError => e
|
218
|
+
if e.response[:status].between?(500, 520) # retry calling the api if the response is any of 500 errors
|
219
|
+
sleep 1
|
220
|
+
retry unless (tries -= 1).zero?
|
221
|
+
end
|
222
|
+
raise TrackerApi::Error.new(e)
|
201
223
|
end
|
202
|
-
response
|
203
|
-
rescue Faraday::Error::ClientError => e
|
204
|
-
raise TrackerApi::Error.new(e)
|
205
224
|
end
|
206
225
|
|
207
226
|
class Pagination
|
@@ -12,6 +12,23 @@ module TrackerApi
|
|
12
12
|
|
13
13
|
Resources::Project.new({ client: client }.merge(data))
|
14
14
|
end
|
15
|
+
|
16
|
+
def create(params={})
|
17
|
+
data = client.post("/projects", params: params).body
|
18
|
+
|
19
|
+
Resources::Project.new({ client: client }.merge(data))
|
20
|
+
end
|
21
|
+
|
22
|
+
def update(id, params={})
|
23
|
+
data = client.put("/projects/#{id}", params: params).body
|
24
|
+
|
25
|
+
Resources::Project.new({ client: client }.merge(data))
|
26
|
+
end
|
27
|
+
|
28
|
+
def delete(id)
|
29
|
+
client.delete("/projects/#{id}").body
|
30
|
+
end
|
31
|
+
|
15
32
|
end
|
16
33
|
end
|
17
34
|
end
|
@@ -32,6 +32,11 @@ module TrackerApi
|
|
32
32
|
|
33
33
|
story.attributes = data
|
34
34
|
end
|
35
|
+
|
36
|
+
def add_label(story, params = {})
|
37
|
+
raise ArgumentError, 'Valid story required to update.' unless story.instance_of?(Resources::Story)
|
38
|
+
data = client.post("/projects/#{story.project_id}/stories/#{story.id}/labels", params: params).body
|
39
|
+
end
|
35
40
|
end
|
36
41
|
end
|
37
42
|
end
|
@@ -78,12 +78,12 @@ module TrackerApi
|
|
78
78
|
changes_applied
|
79
79
|
end
|
80
80
|
|
81
|
-
#
|
82
|
-
def
|
81
|
+
# Add a new label to a story
|
82
|
+
def add_label(label)
|
83
83
|
raise ArgumentError, 'Can not update a story with an unknown project_id.' if project_id.nil?
|
84
|
-
raise ArgumentError, 'Provide at lease one label name' if
|
84
|
+
raise ArgumentError, 'Provide at lease one label name' if label.empty?
|
85
85
|
|
86
|
-
Endpoints::Story.new(client).
|
86
|
+
Endpoints::Story.new(client).add_label(self, {:name => label.to_s})
|
87
87
|
|
88
88
|
changes_applied
|
89
89
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: v2gpti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Wolski
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-07-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: highline
|