Class: Travis::CLI::RepoCommand
- Inherits:
-
ApiCommand
- Object
- Command
- ApiCommand
- Travis::CLI::RepoCommand
- Defined in:
- lib/travis/cli/repo_command.rb
Direct Known Subclasses
Branches, Cache, Cancel, Disable, Enable, Encrypt, EncryptFile, Env, History, Logs, Open, Pubkey, Requests, Restart, Settings, Setup, Show, Sshkey, Status
Constant Summary collapse
- GIT_REGEX =
%r{/?(.*/.+?)(\.git)?$}
- TRAVIS =
%r{^https://(staging-)?api\.travis-ci\.(org|com)}
Constants inherited from Command
Command::DAY, Command::HOUR, Command::MINUTE, Command::WEEK
Constants included from Tools::Assets
Instance Attribute Summary collapse
-
#slug ⇒ Object
Returns the value of attribute slug.
Attributes inherited from ApiCommand
Attributes inherited from Command
#arguments, #config, #debug, #force_interactive, #formatter, #input, #output
Instance Method Summary collapse
Methods inherited from ApiCommand
#authenticate, #endpoint_config, #enterprise?, #initialize, #org?, #pro?, #sync
Methods included from Travis::Client::Methods
#access_token, #access_token=, #account, #accounts, #api_endpoint, #api_endpoint=, #artifact, #broadcasts, #cancel, #explicit_api_endpoint?, #github_auth, #hooks, #lint, #listen, #repo, #repos, #restart, #user
Methods inherited from Command
abstract, abstract?, #check_completion, #check_ruby, #check_version, command_name, #command_name, #debug?, description, #execute, #help, #info, #initialize, #last_check, #on_signal, #parse, #say, skip, subcommands, #terminal, #time, #usage, #usage_for, #write_to
Methods included from Tools::Assets
Methods included from Parser
Constructor Details
This class inherits a constructor from Travis::CLI::ApiCommand
Instance Attribute Details
#slug ⇒ Object
Returns the value of attribute slug.
15 16 17 |
# File 'lib/travis/cli/repo_command.rb', line 15 def slug @slug end |
Instance Method Details
#repository ⇒ Object
27 28 29 30 31 |
# File 'lib/travis/cli/repo_command.rb', line 27 def repository repo(slug) rescue Travis::Client::NotFound error "repository not known to #{api_endpoint}: #{color(slug, :important)}" end |
#setup ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/travis/cli/repo_command.rb', line 18 def setup setup_enterprise 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 <owner>/<repo>)" unless self.slug ||= find_slug error "GitHub repo name is invalid, it should be on the form 'owner/repo'" unless self.slug.include?("/") self.api_endpoint = detect_api_endpoint super repository.load # makes sure we actually have access to the repo end |