class Thegarage::Gitx::Cli::ReleaseCommand

Public Instance Methods

release(branch = nil) click to toggle source
# File lib/thegarage/gitx/cli/release_command.rb, line 17
def release(branch = nil)
  return unless yes?("Release #{current_branch.name} to production? (y/n)", :green)

  branch ||= current_branch.name
  assert_not_protected_branch!(branch, 'release')
  checkout_branch(branch)
  execute_command(UpdateCommand, :update)

  find_or_create_pull_request(branch)
  status = branch_status(branch)
  if status != 'success'
    return unless yes?("Branch status is currently: #{status}.  Proceed with release? (y/n)", :red)
  end

  checkout_branch Thegarage::Gitx::BASE_BRANCH
  run_cmd "git pull origin #{Thegarage::Gitx::BASE_BRANCH}"
  run_cmd "git merge --no-ff #{branch}"
  run_cmd "git push origin HEAD"

  execute_command(IntegrateCommand, :integrate, 'staging')
  execute_command(CleanupCommand, :cleanup) if options[:cleanup]
end