class Codeowners::Cli::OwnersListHandler

Command Line Interface dealing with OWNERS generation and validation

Constants

ASK_GITHUB_ORGANIZATION
ASK_GITHUB_TOKEN
FETCH_OWNER_MESSAGE

Public Instance Methods

fetch(repo = '.') click to toggle source
# File lib/codeowners/cli/owners_list_handler.rb, line 16
def fetch(repo = '.')
  @repo = repo
  owners = owners_from_github
  Checker::OwnersList.persist!(repo, owners)
end
owners_from_github() click to toggle source
# File lib/codeowners/cli/owners_list_handler.rb, line 23
def owners_from_github
  organization = config.default_organization
  organization = ask(ASK_GITHUB_ORGANIZATION) if organization.empty?
  token = ENV['GITHUB_TOKEN']
  token ||= ask(ASK_GITHUB_TOKEN, echo: false)
  puts FETCH_OWNER_MESSAGE
  Codeowners::GithubFetcher.get_owners(organization, token)
end