class Spore::LocalConfig

Public Class Methods

new() click to toggle source
# File lib/spore/config.rb, line 54
def initialize
  email, key = load_credentials
  @api = Spore::Client.new
  @api.key = key
  @api.name = email
  @api.api_endpoint = server
end

Public Instance Methods

environment() click to toggle source
# File lib/spore/config.rb, line 62
def environment
  ENV["SPORE_ENV"] || @config["defaultEnv"]
end
server() click to toggle source
# File lib/spore/config.rb, line 66
def server
  config["useProxy"] ? "http://127.0.0.1:#{config["proxy"]["port"]}" : config["host"]
end

Private Instance Methods

load_credentials() click to toggle source
# File lib/spore/config.rb, line 72
def load_credentials
  n = Netrc.read(File.expand_path config["netrc"])
  hostname = URI.parse(config["host"]).hostname
  n[hostname]
end