Class: Gitx::Cli::ReviewCommand

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

Constant Summary collapse

BUMP_COMMENT_PREFIX =
'[gitx] review bump :tada:'.freeze
<<-MESSAGE.dedent
  # Bump comments should include:
  # * Summary of what changed
  #
  # This footer will automatically be stripped from the created comment
MESSAGE
APPROVAL_COMMENT_PREFIX =
'[gitx] review approved :shipit:'.freeze
<<-MESSAGE.dedent
  # Approval comments can include:
  # * Feedback
  # * Follow-up items for after release
  #
  # This footer will automatically be stripped from the created comment
MESSAGE
REJECTION_COMMENT_PREFIX =
'[gitx] review rejected'.freeze
<<-MESSAGE.dedent
  # Rejection comments should include:
  # * Feedback
  # * Required changes before approved
  #
  # This footer will automatically be stripped from the created comment
MESSAGE

Constants included from Github

Github::CLIENT_URL, Github::GLOBAL_CONFIG_FILE, Github::PULL_REQEST_TEMPLATE_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_template, #pull_request_template_file, #pull_request_title, #save_global_config, #update_review_status, #username

Methods included from Thor::Actions

#ask_editor

Instance Method Details

#review(branch = nil) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/gitx/cli/review_command.rb', line 44

def review(branch = nil)
  raise 'Github authorization token not found' unless authorization_token

  branch ||= current_branch.name
  pull_request = find_or_create_pull_request(branch)
  bump_pull_request(pull_request) if options[:bump]
  approve_pull_request(pull_request) if options[:approve]
  reject_pull_request(pull_request) if options[:reject]
  assign_pull_request(pull_request) if options[:assignee]

  run_cmd('open', pull_request.html_url) if options[:open]
end