Class: Thegarage::Gitx::Cli::ReleaseCommand

Inherits:
BaseCommand show all
Includes:
Github
Defined in:
lib/thegarage/gitx/cli/release_command.rb

Constant Summary

Constants included from Github

Github::CLIENT_URL, Github::GLOBAL_CONFIG_FILE, Github::PULL_REQUEST_FOOTER, Github::REVIEW_CONTEXT

Instance Method Summary collapse

Methods included from Github

#ask_without_echo, #authorization_token, #branch_status, #create_authorization, #create_pull_request, #find_or_create_pull_request, #find_pull_request, #github_client, #github_client_name, #github_organization, #github_slug, #global_config, #global_config_file, #pull_request_body, #save_global_config, #update_review_status, #username

Methods inherited from BaseCommand

#initialize

Methods included from Thor::Actions

#ask_editor, #run_cmd

Constructor Details

This class inherits a constructor from Thegarage::Gitx::Cli::BaseCommand

Instance Method Details

#releaseObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/thegarage/gitx/cli/release_command.rb', line 17

def release
  return unless yes?("Release #{current_branch.name} to production? (y/n)", :green)

  branch = current_branch.name
  assert_not_protected_branch!(branch, 'release')
  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