Module: CFoundryHelper

Defined in:
lib/cfoundry_helper.rb,
lib/cfoundry_helper/version.rb

Defined Under Namespace

Modules: Errors, Helpers, Models

Constant Summary collapse

VERSION =
"0.3.3"
@@config =
nil

Class Method Summary collapse

Class Method Details

.available_targetsObject

Returns an array of target available target urls defined in the configuration file as strings.



38
39
40
# File 'lib/cfoundry_helper.rb', line 38

def self.available_targets
  self.config.keys
end

.configObject



32
33
34
# File 'lib/cfoundry_helper.rb', line 32

def self.config
  @@config
end

.config_for_target(url) ⇒ Object

Returns the config hash for the given target url as defined in the configuration. Returns nil if the given target url is not defined within the configuration.



44
45
46
# File 'lib/cfoundry_helper.rb', line 44

def self.config_for_target(url)
  self.config[url]
end

.load_config_from_file(file_location) ⇒ Object

Loads the configuration from the specified yaml file.



24
25
26
27
28
29
30
# File 'lib/cfoundry_helper.rb', line 24

def self.load_config_from_file(file_location)
  raise "There's no configuration file on #{file_location}!" unless File.exists? file_location
  config = YAML.load_file(file_location)
  check_config! config
  @@config = config
  @@config
end

.load_config_from_hash(hash) ⇒ Object

Loads the configuration from the specified hash.



16
17
18
19
20
21
# File 'lib/cfoundry_helper.rb', line 16

def self.load_config_from_hash(hash)
  config = hash
  check_config! config
  @@config = config
  @@config
end