Class: GitPivotalTrackerIntegration::Command::Finish
- Defined in:
- lib/git-pivotal-tracker-integration/command/finish.rb
Overview
The class that encapsulates finishing a Pivotal Tracker Story
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
- #commit_new_build ⇒ Object
-
#run(argument) ⇒ void
Finishes a Pivotal Tracker story by doing the following steps: * Check that the pending merge will be trivial * Merge the development branch into the root branch * Delete the development branch * Push changes to remote.
Methods inherited from Base
#check_version, #create_backlog_bug_story, #create_backlog_feature_story, #create_icebox_bug_story, #create_icebox_feature_story, #create_story, #estimated_seconds, #finish_toggle, #initialize, #logger_filename, #parameters, #seconds_spent, #start_logging
Constructor Details
This class inherits a constructor from GitPivotalTrackerIntegration::Command::Base
Instance Method Details
#commit_new_build ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/git-pivotal-tracker-integration/command/finish.rb', line 61 def commit_new_build # Update version and build numbers build_number = Time.now.utc.strftime("%y%m%d-%H%M") working_directory = pwd puts "build_number:#{build_number}" puts "working_directory:#{working_directory}*" if (OS.mac? && ["y","ios"].include?(@platform.downcase)) project_directory = ((GitPivotalTrackerIntegration::Util::Shell.exec 'find . -name "*.xcodeproj" 2>/dev/null').split /\/(?=[^\/]*$)/)[0] return if project_directory.nil? # cd to the project_directory Dir.chdir(project_directory) # set build number and project number in project file pwd puts GitPivotalTrackerIntegration::Util::Shell.exec "xcrun agvtool new-version -all #{build_number}", false puts GitPivotalTrackerIntegration::Util::Shell.exec "xcrun agvtool new-marketing-version SNAPSHOT" # cd back to the working_directory Dir.chdir(working_directory) end # Create a new build commit, push to develop GitPivotalTrackerIntegration::Util::Git.create_commit( "Update build number to #{build_number}", @configuration.story(@project)) end |
#run(argument) ⇒ void
This method returns an undefined value.
Finishes a Pivotal Tracker story by doing the following steps:
-
Check that the pending merge will be trivial
-
Merge the development branch into the root branch
-
Delete the development branch
-
Push changes to remote
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 |
# File 'lib/git-pivotal-tracker-integration/command/finish.rb', line 30 def run(argument) $LOG.debug("#{self.class} in project:#{@project.name} pwd:#{pwd} branch:#{GitPivotalTrackerIntegration::Util::Git.branch_name}") no_complete = argument =~ /--no-complete/ branch_status_check = GitPivotalTrackerIntegration::Util::Shell.exec "git status -s" 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? # ask("pause") GitPivotalTrackerIntegration::Util::Git.trivial_merge? $LOG.debug("configuration:#{@configuration}") $LOG.debug("project:#{@project}") $LOG.debug("story:#{@configuration.story(@project)}") memm = PivotalTracker::Membership.all(@project) self.commit_new_build time_spent = "" while 1 time_spent = ask("How much time did you spend on this task? (example: 15m, 2.5h)") if (/\d/.match( time_spent )) && /[mhd]/.match(time_spent) break end end finish_toggle(@configuration, time_spent) GitPivotalTrackerIntegration::Util::Git.merge(@configuration.story(@project), no_complete) GitPivotalTrackerIntegration::Util::Git.push GitPivotalTrackerIntegration::Util::Git.branch_name end |