Class: GitPivotalTrackerIntegration::Command::Finish
- Defined in:
- lib/git-pivotal-tracker-integration/command/finish.rb
Overview
The class that encapsulates finishing a Pivotal Tracker Story
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, #initialize, #logger_filename, #seconds_spent, #start_logging
Constructor Details
This class inherits a constructor from GitPivotalTrackerIntegration::Command::Base
Instance Method Details
#commit_new_build ⇒ Object
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 82 83 84 85 |
# File 'lib/git-pivotal-tracker-integration/command/finish.rb', line 53 def commit_new_build # Update version and build numbers # For iOS project the build number separator should be "-" separator = '_' # default separator separator = '-' if OS.mac? && @platform.downcase == 'ios' build_number = Time.now.utc.strftime("%y%m%d#{separator}%H%M") working_directory = pwd puts "build_number:#{build_number}" puts "working_directory:#{working_directory}*" if (OS.mac? && @platform.downcase == 'ios') project_directory = @configuration.xcode_project_path project_directory ||= ((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 Util::Shell.exec "xcrun agvtool new-version -all #{build_number}", false puts Util::Shell.exec "xcrun agvtool new-marketing-version SNAPSHOT" # cd back to the working_directory Dir.chdir(working_directory) elsif @platform.downcase == 'android' updater = VersionUpdate::Gradle.new(@repository_root) updater.update_dev_version(build_number) end # Create a new build commit, push to develop 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
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/git-pivotal-tracker-integration/command/finish.rb', line 29 def run(argument) $LOG.debug("#{self.class} in project:#{@project.name} pwd:#{pwd} branch:#{Util::Git.branch_name}") no_complete = argument =~ /--no-complete/ branch_status_check = 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") Util::Git.trivial_merge? story = @configuration.story(@project) $LOG.debug("configuration:#{@configuration}") $LOG.debug("project:#{@project}") $LOG.debug("story:#{story}") self.commit_new_build Util::Git.merge(@configuration.story(@project), no_complete) Util::Git.push Util::Git.branch_name story.add_label('need code review') end |