Class: Gitx::Cli::ReleaseCommand

Inherits:
BaseCommand show all
Includes:
Github
Defined in:
lib/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, #label_pull_request, #pull_request_body, #pull_request_title, #save_global_config, #update_review_status, #username

Methods included from Thor::Actions

#ask_editor

Instance Method Details

#release(branch = nil) ⇒ Object



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

def release(branch = nil)
  branch ||= current_branch.name

  return unless yes?("Release #{branch} to #{config.base_branch}? (y/n)", :green)

  assert_not_protected_branch!(branch, 'release')
  checkout_branch(branch)
  run_git_cmd 'update'

  pull_request = find_or_create_pull_request(branch)
  return unless confirm_branch_status?(branch)

  if (label = config.release_label)
    label_pull_request pull_request, label
  else
    checkout_branch config.base_branch
    run_git_cmd 'pull', 'origin', config.base_branch
    run_git_cmd 'merge', '--no-ff', '--message', commit_message(branch, pull_request), branch
    run_git_cmd 'push', 'origin', 'HEAD'
  end

  after_release
end