Class: Travis::CLI::Endpoint

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

Constant Summary

Constants inherited from Command

Command::DAY, Command::HOUR, Command::MINUTE, Command::WEEK

Constants included from Tools::Assets

Tools::Assets::BASE

Instance Attribute Summary

Attributes inherited from ApiCommand

#enterprise_name, #session

Attributes inherited from Command

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

Instance Method Summary collapse

Methods inherited from ApiCommand

#authenticate, #detected_endpoint?, #endpoint_config, #enterprise?, #initialize, #org?, #pro?, #setup, #sync

Methods included from Travis::Client::Methods

#access_token, #access_token=, #account, #accounts, #api_endpoint, #api_endpoint=, #artifact, #broadcasts, #build, #cancel, #explicit_api_endpoint?, #github_auth, #hooks, #job, #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, #setup, skip, subcommands, #terminal, #time, #usage, #usage_for, #write_to

Methods included from Parser

#new, #on, #on_initialize

Methods included from Tools::Assets

#asset, #asset_path

Constructor Details

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

Instance Method Details

#runObject


30
31
32
# File 'lib/travis/cli/endpoint.rb', line 30

def run
  github? ? run_github : run_travis
end

#run_githubObject


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

def run_github
  error "--github cannot be combined with --drop-default" if drop_default?
  error "--github cannot be combined with --set-default" if set_default?
  load_gh
  say github_endpoint.to_s, "GitHub endpoint: %s"
end

#run_travisObject


20
21
22
23
24
25
26
27
28
# File 'lib/travis/cli/endpoint.rb', line 20

def run_travis
  if drop_default? and was = config['default_endpoint']
    config.delete('default_endpoint')
    say was, "default API endpoint dropped (was %s)"
  else
    config['default_endpoint'] = api_endpoint if set_default?
    say api_endpoint, "API endpoint: %s#{" (stored as default)" if set_default?}"
  end
end