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.
- checksums.yaml +4 -4
- data/bin/git-deliver +1 -1
- data/bin/git-finish +1 -1
- data/bin/git-newbug +1 -1
- data/bin/git-newfeature +1 -1
- data/bin/git-qa +1 -1
- data/bin/git-release +1 -1
- data/bin/git-report +1 -1
- data/bin/git-start +1 -1
- data/bin/git-uat +1 -1
- data/config_template +16 -0
- data/lib/git-pivotal-tracker-integration/command/base.rb +235 -322
- data/lib/git-pivotal-tracker-integration/command/configuration.rb +183 -109
- data/lib/git-pivotal-tracker-integration/command/deliver.rb +145 -200
- data/lib/git-pivotal-tracker-integration/command/finish.rb +70 -63
- data/lib/git-pivotal-tracker-integration/command/newbug.rb +36 -39
- data/lib/git-pivotal-tracker-integration/command/newfeature.rb +43 -42
- data/lib/git-pivotal-tracker-integration/command/release.rb +171 -203
- data/lib/git-pivotal-tracker-integration/command/report.rb +33 -36
- data/lib/git-pivotal-tracker-integration/command/start.rb +74 -78
- data/lib/git-pivotal-tracker-integration/util/git.rb +202 -204
- data/lib/git-pivotal-tracker-integration/util/shell.rb +19 -16
- data/lib/git-pivotal-tracker-integration/util/story.rb +155 -177
- data/lib/git-pivotal-tracker-integration/version-update/gradle.rb +44 -40
- data/lib/git-pivotal-tracker-integration.rb +44 -0
- data/spec/git-pivotal-tracker-integration/command/configuration_spec.rb +1 -2
- data/spec/git-pivotal-tracker-integration/command/finish_spec.rb +1 -1
- data/spec/git-pivotal-tracker-integration/command/release_spec.rb +1 -1
- data/spec/git-pivotal-tracker-integration/command/start_spec.rb +1 -1
- data/spec/git-pivotal-tracker-integration/util/story_spec.rb +21 -32
- data/tracker_api/lib/tracker_api/client.rb +241 -0
- data/tracker_api/lib/tracker_api/endpoints/activity.rb +38 -0
- data/tracker_api/lib/tracker_api/endpoints/comments.rb +27 -0
- data/tracker_api/lib/tracker_api/endpoints/epic.rb +17 -0
- data/tracker_api/lib/tracker_api/endpoints/epics.rb +20 -0
- data/tracker_api/lib/tracker_api/endpoints/file_attachment.rb +18 -0
- data/tracker_api/lib/tracker_api/endpoints/iterations.rb +20 -0
- data/tracker_api/lib/tracker_api/endpoints/me.rb +17 -0
- data/tracker_api/lib/tracker_api/endpoints/memberships.rb +20 -0
- data/tracker_api/lib/tracker_api/endpoints/notifications.rb +20 -0
- data/tracker_api/lib/tracker_api/endpoints/project.rb +17 -0
- data/tracker_api/lib/tracker_api/endpoints/projects.rb +18 -0
- data/tracker_api/lib/tracker_api/endpoints/stories.rb +20 -0
- data/tracker_api/lib/tracker_api/endpoints/story.rb +37 -0
- data/tracker_api/lib/tracker_api/endpoints/tasks.rb +20 -0
- data/tracker_api/lib/tracker_api/error.rb +18 -0
- data/tracker_api/lib/tracker_api/logger.rb +31 -0
- data/tracker_api/lib/tracker_api/resources/account.rb +18 -0
- data/tracker_api/lib/tracker_api/resources/activity.rb +24 -0
- data/tracker_api/lib/tracker_api/resources/base.rb +71 -0
- data/tracker_api/lib/tracker_api/resources/change.rb +15 -0
- data/tracker_api/lib/tracker_api/resources/comment.rb +20 -0
- data/tracker_api/lib/tracker_api/resources/epic.rb +17 -0
- data/tracker_api/lib/tracker_api/resources/file_attachment.rb +23 -0
- data/tracker_api/lib/tracker_api/resources/iteration.rb +24 -0
- data/tracker_api/lib/tracker_api/resources/label.rb +14 -0
- data/tracker_api/lib/tracker_api/resources/me.rb +21 -0
- data/tracker_api/lib/tracker_api/resources/membership_summary.rb +15 -0
- data/tracker_api/lib/tracker_api/resources/notification.rb +26 -0
- data/tracker_api/lib/tracker_api/resources/person.rb +14 -0
- data/tracker_api/lib/tracker_api/resources/primary_resource.rb +13 -0
- data/tracker_api/lib/tracker_api/resources/project.rb +131 -0
- data/tracker_api/lib/tracker_api/resources/project_membership.rb +16 -0
- data/tracker_api/lib/tracker_api/resources/story.rb +102 -0
- data/tracker_api/lib/tracker_api/resources/task.rb +16 -0
- data/tracker_api/lib/tracker_api/resources/time_zone.rb +13 -0
- data/tracker_api/lib/tracker_api/version.rb +3 -0
- data/tracker_api/lib/tracker_api.rb +60 -0
- metadata +202 -53
- data/lib/git-pivotal-tracker-integration/command/command.rb +0 -20
- data/lib/git-pivotal-tracker-integration/util/util.rb +0 -20
- data/lib/git-pivotal-tracker-integration/version-update/version_update.rb +0 -20
- data/lib/git_pivotal_tracker_integration.rb +0 -18
@@ -13,223 +13,168 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
#
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
16
|
+
module GitPivotalTrackerIntegration
|
17
|
+
module Command
|
18
|
+
# The class that encapsulates starting a Pivotal Tracker Story
|
19
|
+
class Deliver < Base
|
20
|
+
|
21
|
+
# Starts a Pivotal Tracker story by doing the following steps:
|
22
|
+
# * Create a branch
|
23
|
+
# * Add default commit hook
|
24
|
+
# * Start the story on Pivotal Tracker
|
25
|
+
#
|
26
|
+
# @param [String, nil] filter a filter for selecting the story to start. This
|
27
|
+
# filter can be either:
|
28
|
+
# * a story id
|
29
|
+
# * a story type (feature, bug, chore)
|
30
|
+
# * +nil+
|
31
|
+
# @return [void]
|
32
|
+
def run(filter)
|
33
|
+
$LOG.debug("#{self.class} in project:#{@project.name} pwd:#{pwd} branch:#{Util::Git.branch_name}")
|
34
|
+
self.check_branch
|
35
|
+
story = Util::Story.select_release @project
|
36
|
+
$LOG.debug("Release Story:#{story.name}")
|
37
|
+
sort_for_deliver story
|
38
|
+
Util::Story.pretty_print story
|
39
|
+
|
40
|
+
current_branch = Util::Git.branch_name
|
41
|
+
|
42
|
+
puts "Merging from orgin develop..."
|
43
|
+
Util::Shell.exec "git pull"
|
44
|
+
|
45
|
+
# checkout QA branch
|
46
|
+
# Merge develop into QA
|
47
|
+
Util::Shell.exec "git checkout QA"
|
48
|
+
Util::Shell.exec "git reset --hard origin/QA"
|
49
|
+
Util::Shell.exec "git pull"
|
50
|
+
if (Util::Shell.exec "git merge -s recursive --strategy-option theirs develop")
|
51
|
+
puts "Merged 'develop' in to 'QA'"
|
52
|
+
else
|
53
|
+
abort "FAILED to merge 'develop' in to 'QA'"
|
54
|
+
end
|
55
|
+
|
56
|
+
# retrieve build number from story name
|
57
|
+
build_number = story.name.slice(1..-1)
|
58
|
+
working_directory = pwd
|
59
|
+
|
60
|
+
puts "Story Name: #{story.name}"
|
61
|
+
puts "Build Number: #{build_number}"
|
62
|
+
puts "Working Directory: #{working_directory}*"
|
63
|
+
puts ""
|
64
|
+
|
65
|
+
if (OS.mac? && @platform.downcase == "ios")
|
66
|
+
project_directory = ((Util::Shell.exec 'find . -name "*.xcodeproj" 2>/dev/null').split /\/(?=[^\/]*$)/)[0]
|
67
|
+
|
68
|
+
# cd to the project_directory
|
69
|
+
Dir.chdir(project_directory)
|
70
|
+
|
71
|
+
# set build number and project number in project file
|
72
|
+
pwd
|
73
|
+
puts Util::Shell.exec "xcrun agvtool new-version -all #{build_number}", false
|
74
|
+
puts Util::Shell.exec "xcrun agvtool new-marketing-version SNAPSHOT"
|
75
|
+
|
76
|
+
# cd back to the working_directory
|
77
|
+
Dir.chdir(working_directory)
|
78
|
+
elsif @platform == 'android'
|
79
|
+
updater = VersionUpdate::Gradle.new(@repository_root)
|
80
|
+
updater.update_qa_version(build_number)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Create a new build commit, push to QA, checkout develop
|
84
|
+
Util::Git.create_commit( "Update build number to #{build_number} for delivery to QA", story)
|
85
|
+
puts Util::Shell.exec "git push"
|
86
|
+
puts Util::Shell.exec "git checkout develop"
|
87
|
+
|
88
|
+
i_stories = included_stories @project, story
|
89
|
+
deliver_stories i_stories, story
|
90
|
+
end
|
82
91
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
92
|
+
def check_branch
|
93
|
+
|
94
|
+
current_branch = Util::Git.branch_name
|
95
|
+
suggested_branch = "develop"
|
96
|
+
|
97
|
+
if !suggested_branch.nil? && suggested_branch.length !=0 && current_branch != suggested_branch
|
98
|
+
should_chage_branch = ask("Your currently checked out branch is '#{current_branch}'. You must be on the #{suggested_branch} branch to run this command.\n\n Do you want to checkout '#{suggested_branch}' before starting?(Y/n)")
|
99
|
+
if should_chage_branch != "n"
|
100
|
+
print "Checking out branch '#{suggested_branch}'...\n\n"
|
101
|
+
Util::Shell.exec "git checkout #{suggested_branch}"
|
102
|
+
Util::Shell.exec 'git pull'
|
103
|
+
else
|
104
|
+
abort "You must be on the #{suggested_branch} branch to run this command."
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
87
108
|
|
88
|
-
|
89
|
-
deliver_stories i_stories, story
|
90
|
-
end
|
109
|
+
private
|
91
110
|
|
92
|
-
|
111
|
+
def deliver_stories(stories, build_story)
|
112
|
+
all_stories = stories.dup
|
113
|
+
all_stories << build_story
|
93
114
|
|
94
|
-
|
95
|
-
|
115
|
+
all_stories.each do |story|
|
116
|
+
labels = story.labels.map(&:name)
|
117
|
+
labels << build_story.name
|
118
|
+
labels.uniq!
|
96
119
|
|
97
|
-
|
98
|
-
should_chage_branch = ask("Your currently checked out branch is '#{current_branch}'. You must be on the #{suggested_branch} branch to run this command.\n\n Do you want to checkout '#{suggested_branch}' before starting?(Y/n)")
|
99
|
-
if should_chage_branch != "n"
|
100
|
-
print "Checking out branch '#{suggested_branch}'...\n\n"
|
101
|
-
GitPivotalTrackerIntegration::Util::Shell.exec "git checkout #{suggested_branch}"
|
102
|
-
GitPivotalTrackerIntegration::Util::Shell.exec 'git pull'
|
103
|
-
else
|
104
|
-
abort "You must be on the #{suggested_branch} branch to run this command."
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
120
|
+
story.add_labels(*labels)
|
108
121
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
all_stories.each {|story|
|
118
|
-
# puts "story class:#{story.class}"
|
119
|
-
s_labels_string = story.labels
|
120
|
-
s_labels = ""
|
121
|
-
if (s_labels_string)
|
122
|
-
s_labels = s_labels_string.split(",")
|
123
|
-
s_labels << build_story.name
|
124
|
-
s_labels_string = s_labels.uniq.join(",")
|
125
|
-
else
|
126
|
-
s_labels_string = build_story.name
|
122
|
+
case story.story_type
|
123
|
+
when 'feature', 'bug'
|
124
|
+
story.current_state = 'delivered'
|
125
|
+
when 'chore'
|
126
|
+
story.current_state = 'accepted'
|
127
|
+
end
|
128
|
+
story.save
|
129
|
+
end
|
127
130
|
end
|
128
131
|
|
129
|
-
|
130
|
-
story.update(:labels => s_labels_string)
|
131
|
-
if (story.story_type == "feature") || (story.story_type == "bug")
|
132
|
-
story.update(:current_state => "delivered")
|
133
|
-
elsif (story.story_type == "chore")
|
134
|
-
story.update(:current_state => "accepted")
|
135
|
-
end
|
136
|
-
}
|
137
|
-
end
|
132
|
+
def included_stories(project, build_story)
|
138
133
|
|
139
|
-
|
134
|
+
stories = project.stories(filter: "current_state:finished type:bug,chore,feature -id:#{build_story.id}", limit: 1000)
|
140
135
|
|
141
|
-
|
142
|
-
|
143
|
-
output << "Included stories:\n"
|
136
|
+
# capture story details in a file as well as to stdout
|
137
|
+
notes_file = ENV['HOME']+"/#{project.name}-#{build_story.name}"
|
144
138
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
:story_type => CANDIDATE_TYPES
|
149
|
-
}
|
139
|
+
File.open(notes_file, 'w') do |file|
|
140
|
+
puts "Included Stories"
|
141
|
+
file.puts "Included Stories"
|
150
142
|
|
143
|
+
stories.each do |story|
|
144
|
+
file.puts "#{story.id} - #{story.name}"
|
145
|
+
puts "#{story.id} - #{story.name}"
|
146
|
+
end
|
147
|
+
end
|
151
148
|
|
152
|
-
|
153
|
-
|
154
|
-
# only include stories that have been estimated
|
155
|
-
estimated_candidates = Array.new
|
156
|
-
val_is_valid = true
|
157
|
-
puts "Included stories:\n"
|
158
|
-
candidates.each do |val|
|
159
|
-
val_is_valid = true
|
160
|
-
if (val.id == build_story.id)
|
161
|
-
next
|
162
|
-
end
|
163
|
-
if (val.current_state != "finished")
|
164
|
-
val_is_valid = false
|
149
|
+
stories
|
165
150
|
end
|
166
|
-
if (val.story_type == "release")
|
167
|
-
val_is_valid = false
|
168
|
-
end
|
169
|
-
if val_is_valid
|
170
|
-
# puts "val_is_valid:#{val_is_valid}"
|
171
|
-
estimated_candidates << val
|
172
|
-
output << "#{val.id}\n"
|
173
|
-
puts "#{val.id}"
|
174
151
|
|
152
|
+
def sort_for_deliver(release_story)
|
153
|
+
last_release = Util::Story.last_release_story(@project, "b")
|
154
|
+
stories = included_stories(@project, release_story)
|
155
|
+
last_release = stories.shift if last_release.nil?
|
156
|
+
|
157
|
+
abort "\nThere are no last release stories or finished stories to deliver" if last_release.nil?
|
158
|
+
stories << release_story
|
159
|
+
previous_story = last_release.dup
|
160
|
+
|
161
|
+
puts "Last release:#{previous_story.name}"
|
162
|
+
last_accepted_release_story = @project.stories(filter: "current_state:accepted type:release").last
|
163
|
+
not_accepted_releases = @project.stories(filter: "current_state:unstarted type:release")
|
164
|
+
stories.reverse!
|
165
|
+
|
166
|
+
stories.each do |story|
|
167
|
+
if not_accepted_releases.size == 1 && !last_accepted_release_story.nil?
|
168
|
+
story.after_id = last_accepted_release_story.id
|
169
|
+
elsif previous_story.current_state == 'accepted'
|
170
|
+
story.after_id = not_accepted_releases[not_accepted_releases.size - 2].id
|
171
|
+
else
|
172
|
+
story.after_id = previous_story.id
|
173
|
+
end
|
174
|
+
story.save
|
175
|
+
end
|
175
176
|
end
|
176
|
-
end
|
177
|
-
output.close
|
178
|
-
candidates = estimated_candidates
|
179
|
-
end
|
180
|
-
|
181
177
|
|
182
|
-
def development_branch_name(story)
|
183
|
-
prefix = "#{story.id}-"
|
184
|
-
story_name = "#{story.name.gsub(/[^0-9a-z\\s]/i, '_')}"
|
185
|
-
if(story_name.length > 30)
|
186
|
-
suggested_suffix = story_name[0..27]
|
187
|
-
suggested_suffix << "__"
|
188
|
-
else
|
189
|
-
suggested_suffix = story_name
|
190
178
|
end
|
191
|
-
branch_name = "#{prefix}" + ask("Enter branch name (#{story.id}-<#{suggested_suffix}>): ")
|
192
|
-
puts
|
193
|
-
if branch_name == "#{prefix}"
|
194
|
-
branch_name << suggested_suffix
|
195
|
-
end
|
196
|
-
branch_name.gsub(/[^0-9a-z\\s\-]/i, '_')
|
197
179
|
end
|
198
|
-
|
199
|
-
def start_on_tracker(story)
|
200
|
-
print 'Starting story on Pivotal Tracker... '
|
201
|
-
story.update(
|
202
|
-
:current_state => 'started',
|
203
|
-
:owned_by => GitPivotalTrackerIntegration::Util::Git.get_config('user.name')
|
204
|
-
)
|
205
|
-
puts 'OK'
|
206
|
-
end
|
207
|
-
|
208
|
-
def sort_for_deliver(release_story)
|
209
|
-
last_release = GitPivotalTrackerIntegration::Util::Story.last_release_story(@project, "b")
|
210
|
-
stories = included_stories(@project, release_story)
|
211
|
-
if last_release.nil?
|
212
|
-
last_release = stories[0]
|
213
|
-
stories.shift
|
214
|
-
end
|
215
|
-
abort "\nThere are no last release stories or finished stories to deliver" if last_release.nil?
|
216
|
-
stories << release_story
|
217
|
-
previous_story = last_release.dup
|
218
|
-
|
219
|
-
puts "Last release:#{previous_story.name}"
|
220
|
-
last_accepted_release_story=@project.stories.all(:current_state => 'accepted', :story_type => 'release').last
|
221
|
-
not_accepted_releases = @project.stories.all(:current_state => 'unstarted', :story_type => 'release')
|
222
|
-
stories.reverse!
|
223
|
-
|
224
|
-
stories.each do |story|
|
225
|
-
if not_accepted_releases.size == 1 && !last_accepted_release_story.nil?
|
226
|
-
story.move(:after, last_accepted_release_story)
|
227
|
-
elsif previous_story.current_state == 'accepted'
|
228
|
-
story.move(:after, not_accepted_releases[not_accepted_releases.size - 2])
|
229
|
-
else
|
230
|
-
story.move(:after, previous_story)
|
231
|
-
end
|
232
|
-
end
|
233
|
-
end
|
234
|
-
|
235
180
|
end
|
@@ -13,78 +13,85 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
16
|
+
module GitPivotalTrackerIntegration
|
17
|
+
module Command
|
18
|
+
|
19
|
+
# The class that encapsulates finishing a Pivotal Tracker Story
|
20
|
+
class Finish < Base
|
21
|
+
|
22
|
+
# Finishes a Pivotal Tracker story by doing the following steps:
|
23
|
+
# * Check that the pending merge will be trivial
|
24
|
+
# * Merge the development branch into the root branch
|
25
|
+
# * Delete the development branch
|
26
|
+
# * Push changes to remote
|
27
|
+
#
|
28
|
+
# @return [void]
|
29
|
+
def run(argument)
|
30
|
+
$LOG.debug("#{self.class} in project:#{@project.name} pwd:#{pwd} branch:#{Util::Git.branch_name}")
|
31
|
+
no_complete = argument =~ /--no-complete/
|
32
|
+
|
33
|
+
branch_status_check = Util::Shell.exec "git status -s"
|
34
|
+
abort "\n\nThere are some unstaged changes in your current branch. Please do execute the below commands first and then try with git finish \n git add . \n git commit -m '<your-commit-message>'" unless branch_status_check.empty?
|
35
|
+
|
36
|
+
# ask("pause")
|
37
|
+
Util::Git.trivial_merge?
|
38
|
+
story = @configuration.story(@project)
|
39
|
+
|
40
|
+
$LOG.debug("configuration:#{@configuration}")
|
41
|
+
$LOG.debug("project:#{@project}")
|
42
|
+
$LOG.debug("story:#{story}")
|
43
|
+
|
44
|
+
self.commit_new_build
|
45
|
+
|
46
|
+
time_spent = ""
|
47
|
+
while 1
|
48
|
+
time_spent = ask("How much time did you spend on this task? (example: 15m, 2.5h)")
|
49
|
+
if (/\d/.match( time_spent )) && /[mhd]/.match(time_spent)
|
50
|
+
break
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
finish_toggle(@configuration, time_spent)
|
55
|
+
|
56
|
+
Util::Git.merge(@configuration.story(@project), no_complete)
|
57
|
+
Util::Git.push Util::Git.branch_name
|
58
|
+
|
59
|
+
labels = story.labels.map(&:name)
|
60
|
+
labels << "Need code review"
|
61
|
+
story.add_labels(*labels)
|
51
62
|
end
|
52
|
-
end
|
53
|
-
|
54
|
-
finish_toggle(@configuration, time_spent)
|
55
63
|
|
56
|
-
GitPivotalTrackerIntegration::Util::Git.merge(@configuration.story(@project), no_complete)
|
57
|
-
GitPivotalTrackerIntegration::Util::Git.push GitPivotalTrackerIntegration::Util::Git.branch_name
|
58
|
-
end
|
59
64
|
|
65
|
+
def commit_new_build
|
66
|
+
# Update version and build numbers
|
67
|
+
build_number = Time.now.utc.strftime("%y%m%d_%H%M")
|
68
|
+
working_directory = pwd
|
60
69
|
|
61
|
-
|
62
|
-
|
63
|
-
build_number = Time.now.utc.strftime("%y%m%d-%H%M")
|
64
|
-
working_directory = pwd
|
70
|
+
puts "build_number:#{build_number}"
|
71
|
+
puts "working_directory:#{working_directory}*"
|
65
72
|
|
66
|
-
|
67
|
-
|
73
|
+
if (OS.mac? && @platform.downcase == 'ios')
|
74
|
+
project_directory = ((Util::Shell.exec 'find . -name "*.xcodeproj" 2>/dev/null').split /\/(?=[^\/]*$)/)[0]
|
75
|
+
return if project_directory.nil?
|
68
76
|
|
69
|
-
|
70
|
-
|
71
|
-
return if project_directory.nil?
|
77
|
+
# cd to the project_directory
|
78
|
+
Dir.chdir(project_directory)
|
72
79
|
|
73
|
-
|
74
|
-
|
80
|
+
# set build number and project number in project file
|
81
|
+
pwd
|
82
|
+
puts Util::Shell.exec "xcrun agvtool new-version -all #{build_number}", false
|
83
|
+
puts Util::Shell.exec "xcrun agvtool new-marketing-version SNAPSHOT"
|
75
84
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
85
|
+
# cd back to the working_directory
|
86
|
+
Dir.chdir(working_directory)
|
87
|
+
elsif @platform == 'android'
|
88
|
+
updater = VersionUpdate::Gradle.new(@repository_root)
|
89
|
+
updater.update_dev_version(build_number)
|
90
|
+
end
|
91
|
+
# Create a new build commit, push to develop
|
92
|
+
Util::Git.create_commit( "Update build number to #{build_number}", @configuration.story(@project))
|
93
|
+
end
|
80
94
|
|
81
|
-
# cd back to the working_directory
|
82
|
-
Dir.chdir(working_directory)
|
83
95
|
end
|
84
|
-
|
85
|
-
# Create a new build commit, push to develop
|
86
|
-
GitPivotalTrackerIntegration::Util::Git.create_commit( "Update build number to #{build_number}", @configuration.story(@project))
|
87
96
|
end
|
88
|
-
|
89
|
-
|
90
97
|
end
|
@@ -13,47 +13,44 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
require 'pivotal-tracker'
|
16
|
+
module GitPivotalTrackerIntegration
|
17
|
+
module Command
|
18
|
+
# The class that encapsulates creating a Pivotal Tracker Bug Story
|
19
|
+
class Newbug < Base
|
21
20
|
|
22
|
-
#
|
23
|
-
|
21
|
+
# Creates a Pivotal Tracker story by doing the following steps:
|
22
|
+
# * Takes arguments from command line
|
23
|
+
# * If arguments contains -i then it creates a bug story under icebox
|
24
|
+
# * If arguments contains -b then it creates a bug story under backlog
|
25
|
+
# * If arguments contains -tl then it creates a bug story at top of specified list
|
26
|
+
# * If arguments contains -bl then it creates a bug story at bottom of specified list
|
27
|
+
# * If there are no arguments passed then it creates a bug story in icebox top of the list if you wish to create
|
28
|
+
def run(args)
|
29
|
+
$LOG.debug("#{self.class} in project:#{@project.name} pwd:#{pwd} branch:#{Util::Git.branch_name}")
|
30
|
+
story = nil
|
31
|
+
if (args.include?("-i")) #icebox
|
32
|
+
story = create_icebox_bug_story(args)
|
33
|
+
elsif (args.include?("-b")) #backlog
|
34
|
+
story = create_backlog_bug_story(args)
|
35
|
+
else
|
36
|
+
puts "\n Syntax for creating new bug story in icebox top of the list:\n git newbug -i -tl <bug-title> \n Syntax for creating new bug story in icebox bottom of the list: \n git newbug -i -bl <bug-title>\n"
|
37
|
+
puts "\n Syntax for creating new bug story in backlog top of the list:\n git newbug -b -tl <bug-title> \n Syntax for creating new bug story in backlog bottom of the list: \n git newbug -b -bl <bug-title>\n"
|
38
|
+
user_response = nil
|
39
|
+
while (user_response.nil? || user_response.empty?)
|
40
|
+
user_response = ask("\nYou have missed some parameters to pass...If you are ok with creating new bug story in icebox then enter y otherwise enter n")
|
41
|
+
end
|
42
|
+
while !(["y","n"].include?(user_response))
|
43
|
+
user_response = ask("\nInvalid entry...If you are ok with creating new bug story in icebox then enter y otherwise enter n")
|
44
|
+
end
|
45
|
+
if user_response.downcase == "y"
|
46
|
+
story = self.create_icebox_bug_story(args)
|
47
|
+
else
|
48
|
+
abort "\nCheck your new bug story creation syntax and then try again"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
puts "A new bug story has been created successfully with ID:#{story.id}"
|
52
|
+
end
|
24
53
|
|
25
|
-
# Creates a Pivotal Tracker story by doing the following steps:
|
26
|
-
# * Takes arguments from command line
|
27
|
-
# * If arguments contains -i then it creates a bug story under icebox
|
28
|
-
# * If arguments contains -b then it creates a bug story under backlog
|
29
|
-
# * If arguments contains -tl then it creates a bug story at top of specified list
|
30
|
-
# * If arguments contains -bl then it creates a bug story at bottom of specified list
|
31
|
-
# * If there are no arguments passed then it creates a bug story in icebox top of the list if you wish to create
|
32
|
-
def run(args)
|
33
|
-
my_projects = PivotalTracker::Project.all
|
34
|
-
$LOG.debug("#{self.class} in project:#{@project.name} pwd:#{pwd} branch:#{GitPivotalTrackerIntegration::Util::Git.branch_name}")
|
35
|
-
story = nil
|
36
|
-
if (!args.empty? && args.any?{|arg| arg.include?("-i")})
|
37
|
-
story = self.create_icebox_bug_story(args)
|
38
|
-
elsif (!args.empty? && args.any?{|arg| arg.include?("-b")})
|
39
|
-
story = self.create_backlog_bug_story(args)
|
40
|
-
else
|
41
|
-
puts "\n Syntax for creating new bug story in icebox top of the list:\n git newbug -i -tl <bug-title> \n Syntax for creating new bug story in icebox bottom of the list: \n git newbug -i -bl <bug-title>\n"
|
42
|
-
puts "\n Syntax for creating new bug story in backlog top of the list:\n git newbug -b -tl <bug-title> \n Syntax for creating new bug story in backlog bottom of the list: \n git newbug -b -bl <bug-title>\n"
|
43
|
-
user_response = nil
|
44
|
-
while (user_response.nil? || user_response.empty?)
|
45
|
-
user_response = ask("\nYou have missed some parameters to pass...If you are ok with creating new bug story in icebox then enter y otherwise enter n")
|
46
|
-
end
|
47
|
-
while !(["y","n"].include?(user_response))
|
48
|
-
user_response = ask("\nInvalid entry...If you are ok with creating new bug story in icebox then enter y otherwise enter n")
|
49
|
-
end
|
50
|
-
if user_response.downcase == "y"
|
51
|
-
story = self.create_icebox_bug_story(args)
|
52
|
-
else
|
53
|
-
abort "\nCheck your new bug story creation syntax and then try again"
|
54
|
-
end
|
55
54
|
end
|
56
|
-
puts "A new bug story has been created successfully with ID:#{story.id}"
|
57
55
|
end
|
58
|
-
|
59
56
|
end
|