Class: Ridley::Environment
- Inherits:
-
Object
- Object
- Ridley::Environment
- Includes:
- Resource
- Defined in:
- lib/ridley/resources/environment.rb
Overview
Class Method Summary collapse
-
.delete_all(connection) ⇒ Array<Ridley::Environment>
Delete all of the environments on the remote connection.
Instance Method Summary collapse
- #cookbook_versions=(hash) ⇒ Object
- #default_attributes=(hash) ⇒ Object
- #override_attributes=(hash) ⇒ Object
-
#set_default_attribute(key, value) ⇒ HashWithIndifferentAccess
Set an environment level default attribute given the dotted path representation of the Chef attribute and value.
-
#set_override_attribute(key, value) ⇒ HashWithIndifferentAccess
Set an environment level override attribute given the dotted path representation of the Chef attribute and value.
Methods included from Resource
#<=>, #==, #attribute, #attribute=, #attribute?, #attributes, #attributes=, #chef_id, #eql?, #from_hash, #from_json, #hash, #initialize, #save, #to_hash, #to_json, #to_s
Class Method Details
.delete_all(connection) ⇒ Array<Ridley::Environment>
Delete all of the environments on the remote connection. The ‘_default’ environment will never be deleted.
13 14 15 16 |
# File 'lib/ridley/resources/environment.rb', line 13 def delete_all(connection) envs = all(connection).reject { |env| env.name.to_s == '_default' } envs.collect { |obj| delete(connection, obj) } end |
Instance Method Details
#cookbook_versions=(hash) ⇒ Object
42 43 44 |
# File 'lib/ridley/resources/environment.rb', line 42 def cookbook_versions=(hash) super(HashWithIndifferentAccess.new(hash)) end |
#default_attributes=(hash) ⇒ Object
33 34 35 |
# File 'lib/ridley/resources/environment.rb', line 33 def default_attributes=(hash) super(HashWithIndifferentAccess.new(hash)) end |
#override_attributes=(hash) ⇒ Object
38 39 40 |
# File 'lib/ridley/resources/environment.rb', line 38 def override_attributes=(hash) super(HashWithIndifferentAccess.new(hash)) end |
#set_default_attribute(key, value) ⇒ HashWithIndifferentAccess
Set an environment level default attribute given the dotted path representation of the Chef attribute and value
59 60 61 62 |
# File 'lib/ridley/resources/environment.rb', line 59 def set_default_attribute(key, value) attr_hash = HashWithIndifferentAccess.from_dotted_path(key, value) self.default_attributes = self.default_attributes.merge(attr_hash) end |
#set_override_attribute(key, value) ⇒ HashWithIndifferentAccess
Set an environment level override attribute given the dotted path representation of the Chef attribute and value
77 78 79 80 |
# File 'lib/ridley/resources/environment.rb', line 77 def set_override_attribute(key, value) attr_hash = HashWithIndifferentAccess.from_dotted_path(key, value) self.override_attributes = self.override_attributes.merge(attr_hash) end |