lib/travis/cli/api_command.rb in travis-1.5.7.travis.345.4 vs lib/travis/cli/api_command.rb in travis-1.5.7
- old
+ new
@@ -45,11 +45,11 @@
config['endpoints'] ||= {}
config['endpoints'][api_endpoint] ||= {}
end
def setup
- setup_enterprise if enterprise?
+ setup_enterprise
self.api_endpoint = default_endpoint if default_endpoint and not explicit_api_endpoint?
self.access_token ||= fetch_token
endpoint_config['access_token'] ||= access_token
endpoint_config['insecure'] = insecure unless insecure.nil?
self.insecure = endpoint_config['insecure']
@@ -93,10 +93,11 @@
end
private
def setup_enterprise
+ return unless setup_enterprise?
c = config['enterprise'] ||= {}
c[enterprise_name] = api_endpoint if explicit_api_endpoint?
c[enterprise_name] ||= write_to($stderr) do
error "enterprise setup not configured" unless interactive?
user_input = ask(color("Enterprise domain: ", :bold)).to_s
@@ -106,13 +107,15 @@
endpoint
end
self.api_endpoint = c[enterprise_name]
self.insecure = true if insecure.nil?
endpoint_config['enterprise'] = true
+ @setup_ennterpise = true
end
- def enterprise?
- !!enterprise_name
+ def setup_enterprise?
+ @setup_ennterpise ||= false
+ !!enterprise_name and not @setup_ennterpise
end
def load_gh
return if defined? GH
require 'gh'