Module: Squall
- Extended by:
- Squall
- Included in:
- Squall
- Defined in:
- lib/squall.rb,
lib/squall/disk.rb,
lib/squall/role.rb,
lib/squall/user.rb,
lib/squall/network.rb,
lib/squall/payment.rb,
lib/squall/template.rb,
lib/squall/statistic.rb,
lib/squall/whitelist.rb,
lib/squall/hypervisor.rb,
lib/squall/ip_address.rb,
lib/squall/user_group.rb,
lib/squall/transaction.rb,
lib/squall/network_zone.rb,
lib/squall/support/base.rb,
lib/squall/firewall_rule.rb,
lib/squall/support/config.rb,
lib/squall/data_store_zone.rb,
lib/squall/hypervisor_zone.rb,
lib/squall/ip_address_join.rb,
lib/squall/support/version.rb,
lib/squall/virtual_machine.rb,
lib/squall/support/exception.rb
Defined Under Namespace
Classes: Base, Config, DataStoreZone, Disk, FirewallRule, Hypervisor, HypervisorZone, IpAddress, IpAddressJoin, Network, NetworkZone, NoConfig, Payment, Role, Statistic, Template, Transaction, User, UserGroup, VirtualMachine, Whitelist
Constant Summary collapse
- VERSION =
'1.4.0'
Instance Attribute Summary collapse
-
#configuration ⇒ Object
Config.
-
#configuration_file ⇒ Object
Config.
Instance Method Summary collapse
-
#config {|self.configuration| ... } ⇒ Object
Public: Configures Squall.
-
#config_file(file = File.expand_path("~/.squall.yml")) ⇒ Object
Public: Load the config from a YAML file.
-
#reset_config ⇒ Object
Public: Reset the config (aka, clear it).
Instance Attribute Details
#configuration ⇒ Object
Config
35 36 37 |
# File 'lib/squall.rb', line 35 def configuration @configuration end |
#configuration_file ⇒ Object
Config
38 39 40 |
# File 'lib/squall.rb', line 38 def configuration_file @configuration_file end |
Instance Method Details
#config {|self.configuration| ... } ⇒ Object
Public: Configures Squall.
Yields Squall.configuration if a block is given.
Example
Squall.config do |c|
c.base_uri 'http://onapp.myserver.com'
c.username 'myuser'
c.password 'mypass'
c.debug true
end
Returns a Hash.
56 57 58 59 |
# File 'lib/squall.rb', line 56 def config yield self.configuration if block_given? self.configuration.config end |
#config_file(file = File.expand_path("~/.squall.yml")) ⇒ Object
Public: Load the config from a YAML file.
file - Path to the YAML file, defaults to ‘~/.squall.yml`
Raises ArgumentError if the config file does not exist.
Example
# Load default config file at `~/.squall.yml`:
Squall.config_file
# Load custom config file:
Squall.config_file '/path/to/squall.yml'
Returns nothing.
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/squall.rb', line 76 def config_file(file = File.("~/.squall.yml")) if File.exists?(file) self.configuration_file = file else raise ArgumentError, "Config file doesn't exist '#{file}'" end config do |c| YAML::load_file(file).each { |k, v| c.send(k, v) } end end |