v2gpti 1.1.9 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
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,223 +13,168 @@
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'
21
-
22
- # The class that encapsulates starting a Pivotal Tracker Story
23
- class GitPivotalTrackerIntegration::Command::Deliver < GitPivotalTrackerIntegration::Command::Base
24
-
25
- # Starts a Pivotal Tracker story by doing the following steps:
26
- # * Create a branch
27
- # * Add default commit hook
28
- # * Start the story on Pivotal Tracker
29
- #
30
- # @param [String, nil] filter a filter for selecting the story to start. This
31
- # filter can be either:
32
- # * a story id
33
- # * a story type (feature, bug, chore)
34
- # * +nil+
35
- # @return [void]
36
- def run(filter)
37
- $LOG.debug("#{self.class} in project:#{@project.name} pwd:#{pwd} branch:#{GitPivotalTrackerIntegration::Util::Git.branch_name}")
38
- self.check_branch
39
- story = GitPivotalTrackerIntegration::Util::Story.select_release @project
40
- $LOG.debug("story:#{story.name}")
41
- sort_for_deliver story
42
- GitPivotalTrackerIntegration::Util::Story.pretty_print story
43
-
44
- current_branch = GitPivotalTrackerIntegration::Util::Git.branch_name
45
-
46
- puts "Merging from orgin develop..."
47
- GitPivotalTrackerIntegration::Util::Shell.exec "git pull"
48
-
49
- # checkout QA branch
50
- # Merge develop into QA
51
- GitPivotalTrackerIntegration::Util::Shell.exec "git checkout QA"
52
- GitPivotalTrackerIntegration::Util::Shell.exec "git pull"
53
- if (GitPivotalTrackerIntegration::Util::Shell.exec "git merge -s recursive --strategy-option theirs develop")
54
- puts "Merged 'develop' in to 'QA'"
55
- else
56
- abort "FAILED to merge 'develop' in to 'QA'"
57
- end
58
-
59
- # Update version and build numbers
60
- build_number = story.name.dup
61
- build_number[0] = ""
62
- working_directory = pwd
63
-
64
- puts "storyNAME:#{story.name}"
65
- puts "build_number:#{build_number}"
66
- puts "working_directory:#{working_directory}*"
67
-
68
- if (OS.mac? && @platform.downcase == "ios")
69
- project_directory = ((GitPivotalTrackerIntegration::Util::Shell.exec 'find . -name "*.xcodeproj" 2>/dev/null').split /\/(?=[^\/]*$)/)[0]
70
-
71
- # cd to the project_directory
72
- Dir.chdir(project_directory)
73
-
74
- # set build number and project number in project file
75
- pwd
76
- puts GitPivotalTrackerIntegration::Util::Shell.exec "xcrun agvtool new-version -all #{build_number}", false
77
- puts GitPivotalTrackerIntegration::Util::Shell.exec "xcrun agvtool new-marketing-version SNAPSHOT"
78
-
79
- # cd back to the working_directory
80
- Dir.chdir(working_directory)
81
- end
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
- # Create a new build commit, push to QA, checkout develop
84
- GitPivotalTrackerIntegration::Util::Git.create_commit( "Update build number to #{build_number} for delivery to QA", story)
85
- puts GitPivotalTrackerIntegration::Util::Shell.exec "git push"
86
- puts GitPivotalTrackerIntegration::Util::Shell.exec "git checkout develop"
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
- i_stories = included_stories @project, story
89
- deliver_stories i_stories, story
90
- end
109
+ private
91
110
 
92
- def check_branch
111
+ def deliver_stories(stories, build_story)
112
+ all_stories = stories.dup
113
+ all_stories << build_story
93
114
 
94
- current_branch = GitPivotalTrackerIntegration::Util::Git.branch_name
95
- suggested_branch = "develop"
115
+ all_stories.each do |story|
116
+ labels = story.labels.map(&:name)
117
+ labels << build_story.name
118
+ labels.uniq!
96
119
 
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
- 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
- private
110
-
111
- CANDIDATE_STATES = %w(finished unstarted).freeze
112
- CANDIDATE_TYPES = %w(bug chore feature release)
113
-
114
- def deliver_stories(stories, build_story)
115
- all_stories = stories.dup
116
- all_stories << build_story
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
- # puts "labels:#{s_labels_string}"
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
- def included_stories(project, build_story)
134
+ stories = project.stories(filter: "current_state:finished type:bug,chore,feature -id:#{build_story.id}", limit: 1000)
140
135
 
141
- notes_file = ENV['HOME']+"/#{project.name}-#{build_story.name}"
142
- output = File.open( notes_file, "w")
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
- criteria = {
146
- :current_state => CANDIDATE_STATES,
147
- :limit => 1000,
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
- candidates = project.stories.all criteria
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
- require 'git-pivotal-tracker-integration/command/base'
17
- require 'git-pivotal-tracker-integration/command/command'
18
- require 'git-pivotal-tracker-integration/util/git'
19
-
20
- # The class that encapsulates finishing a Pivotal Tracker Story
21
- class GitPivotalTrackerIntegration::Command::Finish < GitPivotalTrackerIntegration::Command::Base
22
-
23
- # Finishes a Pivotal Tracker story by doing the following steps:
24
- # * Check that the pending merge will be trivial
25
- # * Merge the development branch into the root branch
26
- # * Delete the development branch
27
- # * Push changes to remote
28
- #
29
- # @return [void]
30
- def run(argument)
31
- $LOG.debug("#{self.class} in project:#{@project.name} pwd:#{pwd} branch:#{GitPivotalTrackerIntegration::Util::Git.branch_name}")
32
- no_complete = argument =~ /--no-complete/
33
-
34
- branch_status_check = GitPivotalTrackerIntegration::Util::Shell.exec "git status -s"
35
- 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?
36
-
37
- # ask("pause")
38
- GitPivotalTrackerIntegration::Util::Git.trivial_merge?
39
- $LOG.debug("configuration:#{@configuration}")
40
- $LOG.debug("project:#{@project}")
41
- $LOG.debug("story:#{@configuration.story(@project)}")
42
-
43
- memm = PivotalTracker::Membership.all(@project)
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
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
- def commit_new_build
62
- # Update version and build numbers
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
- puts "build_number:#{build_number}"
67
- puts "working_directory:#{working_directory}*"
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
- if (OS.mac? && @platform.downcase == "ios")
70
- project_directory = ((GitPivotalTrackerIntegration::Util::Shell.exec 'find . -name "*.xcodeproj" 2>/dev/null').split /\/(?=[^\/]*$)/)[0]
71
- return if project_directory.nil?
77
+ # cd to the project_directory
78
+ Dir.chdir(project_directory)
72
79
 
73
- # cd to the project_directory
74
- Dir.chdir(project_directory)
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
- # set build number and project number in project file
77
- pwd
78
- puts GitPivotalTrackerIntegration::Util::Shell.exec "xcrun agvtool new-version -all #{build_number}", false
79
- puts GitPivotalTrackerIntegration::Util::Shell.exec "xcrun agvtool new-marketing-version SNAPSHOT"
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
- 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
+ module GitPivotalTrackerIntegration
17
+ module Command
18
+ # The class that encapsulates creating a Pivotal Tracker Bug Story
19
+ class Newbug < Base
21
20
 
22
- # The class that encapsulates creating a Pivotal Tracker Bug Story
23
- class GitPivotalTrackerIntegration::Command::Newbug < GitPivotalTrackerIntegration::Command::Base
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