Class: Travis::CLI::RepoCommand

Inherits:
ApiCommand show all
Defined in:
lib/travis/cli/repo_command.rb

Constant Summary collapse

GIT_REGEX =
%r{^(?:https://|git://|git@)github\.com[:/](.*/.+?)(\.git)?$}

Instance Attribute Summary collapse

Attributes inherited from ApiCommand

#session

Attributes inherited from Command

#arguments, #config, #force_interactive, #formatter, #input, #output

Instance Method Summary collapse

Methods inherited from ApiCommand

#authenticate, #endpoint_config, #initialize, #org?, #pro?, #sync

Methods included from Travis::Client::Methods

#access_token, #access_token=, #accounts, #api_endpoint, #api_endpoint=, #artifact, #broadcasts, #cancel, #explicit_api_endpoint?, #github_auth, #listen, #repo, #repos, #restart, #user, #worker, #workers

Methods inherited from Command

abstract, abstract?, #check_ruby, #check_version, command_name, #command_name, #debug, description, #execute, #help, #info, #initialize, #last_check, #on_signal, #parse, #say, skip, #terminal, #usage, #write_to

Methods included from Parser

#new, #on, #on_initialize

Constructor Details

This class inherits a constructor from Travis::CLI::ApiCommand

Instance Attribute Details

#slugObject

Returns the value of attribute slug.



10
11
12
# File 'lib/travis/cli/repo_command.rb', line 10

def slug
  @slug
end

Instance Method Details

#repositoryObject



20
21
22
23
24
# File 'lib/travis/cli/repo_command.rb', line 20

def repository
  repo(slug)
rescue Travis::Client::NotFound
  error "repository not known to #{api_endpoint}: #{color(slug, :important)}"
end

#setupObject



13
14
15
16
17
18
# File 'lib/travis/cli/repo_command.rb', line 13

def setup
  error "Can't figure out GitHub repo name. Ensure you're in the repo directory, or specify the repo name via the -r option (e.g. travis <command> -r <repo-name>)" unless self.slug ||= find_slug
  self.api_endpoint = detect_api_endpoint
  super
  repository.load # makes sure we actually have access to the repo
end