Class: Thegarage::Gitx::Cli::ReviewCommand

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

Constant Summary collapse

BUMP_COMMENT_PREFIX =
'[gitx] review bump :tada:'
<<-EOS.dedent
  # Bump comments should include:
  # * summary of what changed
  #
  # This footer will automatically be stripped from the created comment
EOS
APPROVAL_COMMENT_PREFIX =
'[gitx] review approved :shipit:'
<<-EOS.dedent
  # Approval comments can include:
  # * feedback
  # * post-release follow-up items
  #
  # This footer will automatically be stripped from the created comment
EOS
REJECTION_COMMENT_PREFIX =
'[gitx] review rejected'
<<-EOS.dedent
  # Rejection comments should include:
  # * feedback for fixes required before approved
  #
  # This footer will automatically be stripped from the created comment
EOS

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

#reviewObject



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

def review
  fail '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