Class: Travis::CLI::Login

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

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, #detected_endpoint?, #endpoint_config, #initialize, #org?, #pro?, #setup, #sync

Methods included from Travis::Client::Methods

#access_token, #access_token=, #api_endpoint, #api_endpoint=, #artifact, #build, #explicit_api_endpoint?, #github_auth, #job, #repo, #repos, #restart, #user, #worker, #workers

Methods inherited from Command

abstract, abstract?, command_name, #command_name, #debug, #execute, #help, #initialize, #parse, #say, #setup, 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

#callbackObject

Returns the value of attribute callback


9
10
11
# File 'lib/travis/cli/login.rb', line 9

def callback
  @callback
end

#github_loginObject

Returns the value of attribute github_login


9
10
11
# File 'lib/travis/cli/login.rb', line 9

def 
  @github_login
end

#github_passwordObject

Returns the value of attribute github_password


9
10
11
# File 'lib/travis/cli/login.rb', line 9

def github_password
  @github_password
end

#github_tokenObject

Returns the value of attribute github_token


9
10
11
# File 'lib/travis/cli/login.rb', line 9

def github_token
  @github_token
end

Instance Method Details

#runObject


17
18
19
20
21
22
23
# File 'lib/travis/cli/login.rb', line 17

def run
  generate_github_token unless github_token
  endpoint_config['access_token'] = github_auth(github_token)
  success("Successfully logged in!")
ensure
  callback.call if callback
end