v2gpti 1.1.3 → 1.1.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.
@@ -28,9 +28,9 @@ class GitPivotalTrackerIntegration::Command::Finish < GitPivotalTrackerIntegrati
28
28
  #
29
29
  # @return [void]
30
30
  def run(argument)
31
- $LOG.debug("#{self.class} in project:#{@project.name} pwd:#{(GitPivotalTrackerIntegration::Util::Shell.exec 'pwd').chop} branch:#{GitPivotalTrackerIntegration::Util::Git.branch_name}")
31
+ $LOG.debug("#{self.class} in project:#{@project.name} pwd:#{pwd} branch:#{GitPivotalTrackerIntegration::Util::Git.branch_name}")
32
32
  no_complete = argument =~ /--no-complete/
33
-
33
+
34
34
  branch_status_check = GitPivotalTrackerIntegration::Util::Shell.exec "git status -s"
35
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
36
 
@@ -39,8 +39,10 @@ class GitPivotalTrackerIntegration::Command::Finish < GitPivotalTrackerIntegrati
39
39
  $LOG.debug("configuration:#{@configuration}")
40
40
  $LOG.debug("project:#{@project}")
41
41
  $LOG.debug("story:#{@configuration.story(@project)}")
42
+
42
43
  memm = PivotalTracker::Membership.all(@project)
43
44
  self.commit_new_build
45
+
44
46
  time_spent = ""
45
47
  while 1
46
48
  time_spent = ask("How much time did you spend on this task? (example: 15m, 2.5h)")
@@ -48,36 +50,41 @@ class GitPivotalTrackerIntegration::Command::Finish < GitPivotalTrackerIntegrati
48
50
  break
49
51
  end
50
52
  end
53
+
51
54
  finish_toggle(@configuration, time_spent)
55
+
52
56
  GitPivotalTrackerIntegration::Util::Git.merge(@configuration.story(@project), no_complete)
53
57
  GitPivotalTrackerIntegration::Util::Git.push GitPivotalTrackerIntegration::Util::Git.branch_name
54
58
  end
55
59
 
56
60
 
57
- def commit_new_build
58
- # Update version and build numbers
59
- build_number = Time.now.utc.strftime("%y%m%d-%H%M")
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
60
65
 
61
- puts "build_number:#{build_number}"
62
- project_directory = ((GitPivotalTrackerIntegration::Util::Shell.exec 'find . -name "*.xcodeproj" 2>/dev/null').split /\/(?=[^\/]*$)/)[0]
63
- if project_directory.nil?
64
- return
65
- end
66
- working_directory = (GitPivotalTrackerIntegration::Util::Shell.exec "pwd").chop
67
- puts "working_directory:#{working_directory}*"
66
+ puts "build_number:#{build_number}"
67
+ puts "working_directory:#{working_directory}*"
68
68
 
69
- # cd to the project_directory
70
- Dir.chdir(project_directory)
69
+ if (OS.mac? && ["y","ios"].include?(@platform.downcase))
70
+ project_directory = ((GitPivotalTrackerIntegration::Util::Shell.exec 'find . -name "*.xcodeproj" 2>/dev/null').split /\/(?=[^\/]*$)/)[0]
71
+ return if project_directory.nil?
71
72
 
72
- # set build number and project number in project file
73
- GitPivotalTrackerIntegration::Util::Shell.exec "pwd"
74
- puts GitPivotalTrackerIntegration::Util::Shell.exec "xcrun agvtool new-version -all #{build_number}", false
75
- puts GitPivotalTrackerIntegration::Util::Shell.exec "xcrun agvtool new-marketing-version SNAPSHOT"
73
+ # cd to the project_directory
74
+ Dir.chdir(project_directory)
75
+
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"
80
+
81
+ # cd back to the working_directory
82
+ Dir.chdir(working_directory)
83
+ 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
+ end
76
88
 
77
- # cd back to the working_directory
78
- Dir.chdir(working_directory)
79
89
 
80
- # Create a new build commit, push to develop
81
- GitPivotalTrackerIntegration::Util::Git.create_commit( "Update build number to #{build_number}", @configuration.story(@project))
82
- end
83
90
  end
@@ -0,0 +1,59 @@
1
+ # Git Pivotal Tracker Integration
2
+ # Copyright (c) 2013 the original author or authors.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ require '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 creating a Pivotal Tracker Bug Story
23
+ class GitPivotalTrackerIntegration::Command::Newbug < GitPivotalTrackerIntegration::Command::Base
24
+
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
+ end
56
+ puts "A new bug story has been created successfully with ID:#{story.id}"
57
+ end
58
+
59
+ end
@@ -0,0 +1,62 @@
1
+ # Git Pivotal Tracker Integration
2
+ # Copyright (c) 2013 the original author or authors.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ require '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 creating a Pivotal Tracker Bug Story
23
+ class GitPivotalTrackerIntegration::Command::Newfeature < GitPivotalTrackerIntegration::Command::Base
24
+
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 feature story under icebox
28
+ # * If arguments contains -b then it creates a feature story under backlog
29
+ # * If arguments contains -tl then it creates a feature story at top of specified list
30
+ # * If arguments contains -bl then it creates a feature story at bottom of specified list
31
+ # * If arguments contains -p1 then it creates a feature story with estimate as 1 point.
32
+ # * If arguments contains -p2 then it creates a feature story with estimate as 2 points.
33
+ # * If arguments contains -p3 then it creates a feature story with estimate as 3 points.
34
+ # * If there are no arguments passed then it creates a feature story in icebox top of the list if you wish to create
35
+ def run(args)
36
+ my_projects = PivotalTracker::Project.all
37
+ $LOG.debug("#{self.class} in project:#{@project.name} pwd:#{pwd} branch:#{GitPivotalTrackerIntegration::Util::Git.branch_name}")
38
+ story = nil
39
+ if (!args.empty? && args.any?{|arg| arg.include?("-i")})
40
+ story = self.create_icebox_feature_story(args)
41
+ elsif (!args.empty? && args.any?{|arg| arg.include?("-b")})
42
+ story = self.create_backlog_feature_story(args)
43
+ else
44
+ puts "\n Syntax for creating new feature story in icebox top of the list:\n git newfeature -i -tl <feature-title> \n Syntax for creating new feature story in icebox bottom of the list: \n git newfeature -i -bl <feature-title>\n"
45
+ puts "\n Syntax for creating new feature story in backlog top of the list:\n git newfeature -b -tl <feature-title> \n Syntax for creating new feature story in backlog bottom of the list: \n git newfeature -b -bl <feature-title>\n"
46
+ user_response = nil
47
+ while (user_response.nil? || user_response.empty?)
48
+ user_response = ask("\nYou have missed some parameters to pass...If you are ok with creating new feature story in icebox then enter y otherwise enter n")
49
+ end
50
+ while !(["y","n"].include?(user_response.downcase))
51
+ user_response = ask("\nInvalid entry...If you are ok with creating new feature story in icebox then enter y otherwise enter n")
52
+ end
53
+ if user_response.downcase == "y"
54
+ story = self.create_icebox_feature_story(args)
55
+ else
56
+ abort "\nCheck your new feature story creation syntax and then try again"
57
+ end
58
+ end
59
+ puts "A new feature story has been created successfully with ID:#{story.id}"
60
+ end
61
+
62
+ end
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env bash
2
+ # Git Pivotal Tracker Integration
3
+ # Copyright (c) 2013 the original author or authors.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
18
+ STORY_ID=$(git config branch.$CURRENT_BRANCH.pivotal-story-id)
19
+
20
+ if [[ $2 != "commit" && -n $STORY_ID ]]; then
21
+ ORIG_MSG_FILE="$1"
22
+ TEMP="/tmp/git-$RANDOM"
23
+
24
+ (printf "\n\n[#$STORY_ID]" ; cat "$1") > "$TEMP"
25
+ cat "$TEMP" > "$ORIG_MSG_FILE"
26
+ fi
@@ -34,7 +34,7 @@ class GitPivotalTrackerIntegration::Command::Release < GitPivotalTrackerIntegrat
34
34
  # * +nil+
35
35
  # @return [void]
36
36
  def run(filter)
37
- $LOG.debug("#{self.class} in project:#{@project.name} pwd:#{(GitPivotalTrackerIntegration::Util::Shell.exec 'pwd').chop} branch:#{GitPivotalTrackerIntegration::Util::Git.branch_name}")
37
+ $LOG.debug("#{self.class} in project:#{@project.name} pwd:#{pwd} branch:#{GitPivotalTrackerIntegration::Util::Git.branch_name}")
38
38
  story = GitPivotalTrackerIntegration::Util::Story.select_release(@project, filter.nil? ? 'v' : filter)
39
39
  GitPivotalTrackerIntegration::Util::Story.pretty_print story
40
40
  $LOG.debug("story:#{story.name}")
@@ -42,15 +42,15 @@ class GitPivotalTrackerIntegration::Command::Release < GitPivotalTrackerIntegrat
42
42
  current_branch = GitPivotalTrackerIntegration::Util::Git.branch_name
43
43
 
44
44
  # checkout QA branch
45
- # Update QA from origin
45
+ # Update QA from origin
46
46
  puts GitPivotalTrackerIntegration::Util::Shell.exec "git checkout QA"
47
47
  puts GitPivotalTrackerIntegration::Util::Shell.exec "git fetch"
48
- puts GitPivotalTrackerIntegration::Util::Shell.exec "git merge -s recursive --strategy-option theirs origin QA"
48
+ GitPivotalTrackerIntegration::Util::Shell.exec "git merge -s recursive --strategy-option theirs origin QA"
49
49
 
50
50
  # checkout master branch
51
51
  # Merge QA into master
52
52
  puts GitPivotalTrackerIntegration::Util::Shell.exec "git checkout master"
53
- puts GitPivotalTrackerIntegration::Util::Shell.exec "git fetch"
53
+ puts GitPivotalTrackerIntegration::Util::Shell.exec "git pull"
54
54
  if (GitPivotalTrackerIntegration::Util::Shell.exec "git merge -s recursive --strategy-option theirs QA")
55
55
  puts "Merged 'QA' in to 'master'"
56
56
  else
@@ -58,27 +58,31 @@ class GitPivotalTrackerIntegration::Command::Release < GitPivotalTrackerIntegrat
58
58
  end
59
59
 
60
60
  # Update version and build numbers
61
- version_number = story.name.dup
61
+ version_number = story.name.dup
62
62
  version_number[0] = ""
63
+ working_directory = pwd
64
+
63
65
  puts "storyNAME:#{story.name}"
64
66
  puts "version_number:#{version_number}"
65
- project_directory = ((GitPivotalTrackerIntegration::Util::Shell.exec 'find . -name "*.xcodeproj" 2>/dev/null').split /\/(?=[^\/]*$)/)[0]
66
- working_directory = (GitPivotalTrackerIntegration::Util::Shell.exec "pwd").chop
67
67
  puts "working_directory:#{working_directory}*"
68
-
69
- # cd to the project_directory
70
- Dir.chdir(project_directory)
71
68
 
72
- # set project number in project file
73
- GitPivotalTrackerIntegration::Util::Shell.exec "pwd"
74
- puts GitPivotalTrackerIntegration::Util::Shell.exec "xcrun agvtool new-marketing-version #{version_number}"
69
+ if (OS.mac? && ["y","ios"].include?(@platform.downcase))
70
+ project_directory = ((GitPivotalTrackerIntegration::Util::Shell.exec 'find . -name "*.xcodeproj" 2>/dev/null').split /\/(?=[^\/]*$)/)[0]
71
+
72
+ # cd to the project_directory
73
+ Dir.chdir(project_directory)
75
74
 
76
- # cd back to the working_directory
77
- Dir.chdir(working_directory)
75
+ # set project number in project file
76
+ pwd
77
+ puts GitPivotalTrackerIntegration::Util::Shell.exec "xcrun agvtool new-marketing-version #{version_number}"
78
+
79
+ # cd back to the working_directory
80
+ Dir.chdir(working_directory)
81
+ end
78
82
 
79
83
  # Create a new build commit, push to QA, checkout develop
80
84
  puts GitPivotalTrackerIntegration::Util::Git.create_commit( "Update version number to #{version_number} for delivery to QA", story)
81
- puts GitPivotalTrackerIntegration::Util::Shell.exec "git push"
85
+ puts GitPivotalTrackerIntegration::Util::Shell.exec "git push"
82
86
  puts GitPivotalTrackerIntegration::Util::Shell.exec "git checkout #{current_branch}"
83
87
 
84
88
  s_labels_string = story.labels
@@ -28,7 +28,7 @@ class GitPivotalTrackerIntegration::Command::Report < GitPivotalTrackerIntegrati
28
28
  owned_by = "Jeff Wolski" # hard coded to Jeff Wolski for now
29
29
 
30
30
 
31
- $LOG.debug("#{self.class} in project:#{@project.name} pwd:#{(GitPivotalTrackerIntegration::Util::Shell.exec 'pwd').chop} branch:#{GitPivotalTrackerIntegration::Util::Git.branch_name}")
31
+ $LOG.debug("#{self.class} in project:#{@project.name} pwd:#{pwd} branch:#{GitPivotalTrackerIntegration::Util::Git.branch_name}")
32
32
  bug_title = nil
33
33
  if args.length == 1
34
34
  bug_title = args[0]
@@ -43,19 +43,20 @@ class GitPivotalTrackerIntegration::Command::Report < GitPivotalTrackerIntegrati
43
43
  report_note = ask("Description of bug:")
44
44
  end
45
45
 
46
- current_user = (GitPivotalTrackerIntegration::Util::Shell.exec "git config user.name").chomp
47
- bug_title = "User Reported - #{current_user} - #{bug_title}"
48
- current_user_email = (GitPivotalTrackerIntegration::Util::Shell.exec "git config user.email").chomp
49
- bug_description = "#{current_user_email}\n#{report_note}"
46
+ current_user = (GitPivotalTrackerIntegration::Util::Shell.exec "git config user.name").chomp
47
+ bug_title = "User Reported - #{current_user} - #{bug_title}"
48
+ current_user_email = (GitPivotalTrackerIntegration::Util::Shell.exec "git config user.email").chomp
49
+ bug_description = "#{@project.name}\n#{current_user_email}\n#{report_note}"
50
50
 
51
51
  bug_story = PivotalTracker::Story.new
52
- bug_story.project_id = "1067990"
53
- bug_story.owned_by = owned_by
54
- bug_story.story_type = "bug"
55
- bug_story.name = bug_title
56
- bug_story.description = bug_description
57
- bug_story.labels = "userreported"
58
- uploaded_story = bug_story.create
52
+ bug_story.project_id = "1067990"
53
+ bug_story.owned_by = owned_by
54
+ bug_story.story_type = "bug"
55
+ bug_story.name = bug_title
56
+ bug_story.description = bug_description
57
+ bug_story.labels = "userreported"
58
+ uploaded_story = bug_story.create
59
+
59
60
  uploaded_story.upload_attachment(self.logger_filename)
60
61
  end
61
62
 
@@ -36,7 +36,7 @@ class GitPivotalTrackerIntegration::Command::Start < GitPivotalTrackerIntegratio
36
36
  def run(args)
37
37
  my_projects = PivotalTracker::Project.all
38
38
  filter = args[0]
39
- $LOG.debug("#{self.class} in project:#{@project.name} pwd:#{(GitPivotalTrackerIntegration::Util::Shell.exec 'pwd').chop} branch:#{GitPivotalTrackerIntegration::Util::Git.branch_name} args:#{filter}")
39
+ $LOG.debug("#{self.class} in project:#{@project.name} pwd:#{pwd} branch:#{GitPivotalTrackerIntegration::Util::Git.branch_name} args:#{filter}")
40
40
  self.check_branch
41
41
  story = nil
42
42
  if (!args.nil? && args.any?{|arg| arg.include?("-n")})
@@ -47,13 +47,16 @@ class GitPivotalTrackerIntegration::Command::Start < GitPivotalTrackerIntegratio
47
47
  if story.nil?
48
48
  abort "There are no available stories."
49
49
  end
50
+ if story.story_type == "feature" && story.estimate < 0
51
+ estimate_story(story)
52
+ end
50
53
  $LOG.debug("story:#{story.name}")
51
54
  GitPivotalTrackerIntegration::Util::Story.pretty_print story
52
55
 
53
56
  development_branch_name = development_branch_name story
54
57
  GitPivotalTrackerIntegration::Util::Git.create_branch development_branch_name
55
58
  @configuration.story = story
56
- GitPivotalTrackerIntegration::Util::Git.add_hook 'prepare-commit-msg', File.join(File.dirname(__FILE__), 'prepare-commit-msg.sh')
59
+ GitPivotalTrackerIntegration::Util::Git.add_hook 'prepare-commit-msg', File.join(File.dirname(__FILE__), !OS.windows? ? 'prepare-commit-msg.sh' : 'prepare-commit-msg-win.sh' )
57
60
 
58
61
  start_on_tracker story
59
62
  end
@@ -63,7 +66,7 @@ class GitPivotalTrackerIntegration::Command::Start < GitPivotalTrackerIntegratio
63
66
  current_branch = GitPivotalTrackerIntegration::Util::Git.branch_name
64
67
  # suggested_branch = (GitPivotalTrackerIntegration::Util::Shell.exec "git config --get git-pivotal-tracker-integration.feature-root 2>/dev/null", false).chomp
65
68
  suggested_branch = "develop"
66
-
69
+
67
70
  if !suggested_branch.nil? && suggested_branch.length !=0 && current_branch != suggested_branch
68
71
  $LOG.warn("Currently checked out branch is '#{current_branch}'.")
69
72
  should_chage_branch = ask("Your currently checked out branch is '#{current_branch}'. Do you want to checkout '#{suggested_branch}' before starting?(Y/n)")
@@ -224,7 +224,7 @@ class GitPivotalTrackerIntegration::Util::Git
224
224
  common_ancestor = GitPivotalTrackerIntegration::Util::Shell.exec "git merge-base #{root_branch} #{development_branch}"
225
225
 
226
226
  if root_tip != common_ancestor
227
- abort 'FAIL'
227
+ abort "\n#{root_branch} branch is ahead of your #{development_branch} branch. \nSo please merge #{root_branch} to #{development_branch} and resolve any conflicts if any. Run 'git merge #{root_branch}' and try git finish again."
228
228
  end
229
229
 
230
230
  puts 'OK'
@@ -113,7 +113,7 @@ class GitPivotalTrackerIntegration::Util::Story
113
113
  def self.find_story(project, type, limit)
114
114
  if (type == "b" || type == "v")
115
115
  release_type = type
116
- type = "release"
116
+ type = "release"
117
117
  end
118
118
  criteria = {
119
119
  :current_state => CANDIDATE_STATES,
@@ -131,16 +131,16 @@ class GitPivotalTrackerIntegration::Util::Story
131
131
 
132
132
  candidates.each {|val|
133
133
  val_is_valid = true
134
- if (val.story_type == "feature" )
134
+ if (val.story_type == "feature" )
135
135
  # puts "#{val.story_type} #{val.name}.estimate:#{val.estimate} "
136
136
  if (val.estimate < 0)
137
- # puts "#{val.estimate} < 0"
138
- val_is_valid = false
137
+ # puts "#{val.estimate} < 0"
138
+ val_is_valid = false
139
139
  end
140
140
  elsif (val.story_type == "release")
141
141
  label_string = val.labels
142
142
  if label_string.nil?
143
- label_string = "";
143
+ label_string = "";
144
144
  end
145
145
  if (val.name[0] != release_type) || (label_string.include? val.name)
146
146
  val_is_valid = false
@@ -150,7 +150,7 @@ class GitPivotalTrackerIntegration::Util::Story
150
150
  if val_is_valid
151
151
  # puts "val_is_valid:#{val_is_valid}"
152
152
  estimated_candidates << val
153
- end
153
+ end
154
154
  }
155
155
  candidates = estimated_candidates
156
156
 
@@ -166,6 +166,10 @@ class GitPivotalTrackerIntegration::Util::Story
166
166
  name = type ? story.name : '%-7s %s' % [story.story_type.upcase, story.name]
167
167
  menu.choice(name) { story }
168
168
  end
169
+ menu.choice('Quit') do
170
+ say "Thank you for using v2gpti"
171
+ exit 0
172
+ end
169
173
  end
170
174
 
171
175
  puts
@@ -183,7 +187,7 @@ class GitPivotalTrackerIntegration::Util::Story
183
187
  end
184
188
  end
185
189
 
186
-
190
+
187
191
 
188
192
  story
189
193
  end
@@ -194,9 +198,10 @@ class GitPivotalTrackerIntegration::Util::Story
194
198
  }
195
199
 
196
200
  candidates = project.stories.all criteria
197
- candidates = candidates.select {|x| (x.name[0]==release_type) && !(x.labels.nil? || (!x.labels.include?x.name))}
201
+ candidates = candidates.select {|x| (x.name[0]==release_type) && !(x.labels.nil? || (!x.labels.include? x.name))}
202
+ candidates.sort! {|x,y| y.name <=> x.name }
198
203
 
199
- candidates[-1]
204
+ candidates.first
200
205
  end
201
206
 
202
207
  def self.create_new_release (project, next_release_number)