class Cloud::Sh::Config

Attributes

accounts[R]
raw[R]

Public Class Methods

new() click to toggle source
# File lib/cloud/sh/config.rb, line 8
def initialize
  @accounts = []
  read_config
end

Public Instance Methods

aliases_file() click to toggle source
# File lib/cloud/sh/config.rb, line 29
def aliases_file
  File.expand_path(".cloud_sh_aliases", "~/")
end
config_file() click to toggle source
# File lib/cloud/sh/config.rb, line 25
def config_file
  File.expand_path(".config/cloud-sh.yml", "~")
end
load_accounts() click to toggle source
# File lib/cloud/sh/config.rb, line 19
def load_accounts
  raw["accounts"].each do |account_config|
    accounts << Account.new(account_config)
  end
end
read_config() click to toggle source
# File lib/cloud/sh/config.rb, line 13
def read_config
  return unless File.exist?(config_file)
  @raw = YAML.safe_load(File.read(config_file))
  load_accounts
end