Module: Spice::Config
- Included in:
- Spice
- Defined in:
- lib/spice/config.rb
Constant Summary
- DEFAULT_SERVER_URL =
The default Chef server URL
"http://localhost:4000"- DEFAULT_CHEF_VERSION =
The default Chef version (changing this will enable disable certain features)
"0.10.8"- DEFAULT_USER_AGENT =
The default Spice User-Agent header
"Spice #{Spice::VERSION}"- DEFAULT_CONNECTION_OPTIONS =
Default connection options
{}
- VALID_OPTIONS_KEYS =
An array of valid config options
[ :server_url, :client_name, :key_file, :raw_key, :chef_version, :user_agent, :connection_options ]
Class Method Summary (collapse)
-
+ (Object) extended(base)
Reset all config options to default when the module is extended.
Instance Method Summary (collapse)
-
- (Object) options
Create an options hash from valid options keys.
-
- (Object) reset
Reset all config options to their defaults.
-
- (Object) setup {|Spice| ... }
Convenience method to configure Spice in a block.
Class Method Details
+ (Object) extended(base)
Reset all config options to default when the module is extended
33 34 35 |
# File 'lib/spice/config.rb', line 33 def self.extended(base) base.reset end |
Instance Method Details
- (Object) options
Create an options hash from valid options keys
53 54 55 56 57 |
# File 'lib/spice/config.rb', line 53 def = {} VALID_OPTIONS_KEYS.each{|k| [k] = send(k)} end |
- (Object) reset
Reset all config options to their defaults
60 61 62 63 64 65 66 67 68 |
# File 'lib/spice/config.rb', line 60 def reset self.user_agent = DEFAULT_USER_AGENT self.server_url = DEFAULT_SERVER_URL self.chef_version = DEFAULT_CHEF_VERSION self.client_name = nil self.key_file = nil self.raw_key = nil self. = DEFAULT_CONNECTION_OPTIONS end |
- (Object) setup {|Spice| ... }
Convenience method to configure Spice in a block
47 48 49 50 |
# File 'lib/spice/config.rb', line 47 def setup yield self self end |