#!/usr/bin/env ruby require 'rubygems' require 'gitscape' require "optparse" OVERVIEW = <<-EOS gitscape perform git-related promotions in a consistent manner. The following actions are supported. hotfix_start Creates a branch off live called hotfix/ hotfix_finish [] Merges the branch hotfix/ into live, the current release branch and master. If is omitted and you are already on a hotfix branch, it is used. release_start Branches master, incrementing the release number to create a new release branch, release/i. The release branch is forced to the qa branch. ** These actions update the origin server. ** release_finish After performing several validations, it merges the latest release branch into live and master. Tags are created that facilitate a rollback. ** These actions update the origin server. ** EOS # Parse option overrides. options = {} op = OptionParser.new do |op| op.banner = 'Usage: gitscape [action] [options]' op.separator('Options:') op.on '--trace', 'Verbose output for debugging' do options[:trace] = true end op.on '-h', '--help', 'Show a list of actions' do puts OVERVIEW exit end end args = op.parse(ARGV) # Get the app name. Note that if the app name is 'app', we have to rename it # so that it doesn't conflict with the 'app' subdirectory. if ARGV.size < 1 puts op exit(1) else case ARGV[0] when "hotfix_start" Gitscape::Base.new.hotfix_start ARGV[1] when "hotfix_finish" Gitscape::Base.new.hotfix_finish ARGV[1] when "release_start" Gitscape::Base.new.release_start when "release_finish" Gitscape::Base.new.release_finish ARGV[1].to_i else puts "Unknown command" end end