ridley 0.6.3 → 0.7.0.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/ridley/errors.rb +1 -1
 - data/lib/ridley/resource.rb +12 -127
 - data/lib/ridley/resources/client.rb +32 -18
 - data/lib/ridley/resources/cookbook.rb +3 -5
 - data/lib/ridley/resources/data_bag.rb +3 -5
 - data/lib/ridley/resources/data_bag_item.rb +35 -53
 - data/lib/ridley/resources/environment.rb +13 -22
 - data/lib/ridley/resources/node.rb +22 -32
 - data/lib/ridley/resources/role.rb +15 -18
 - data/lib/ridley/version.rb +1 -1
 - data/lib/ridley.rb +0 -1
 - data/ridley.gemspec +1 -2
 - data/spec/support/shared_examples/ridley_resource.rb +1 -91
 - data/spec/unit/ridley/resource_spec.rb +15 -135
 - data/spec/unit/ridley/resources/environment_spec.rb +0 -32
 - data/spec/unit/ridley/resources/node_spec.rb +3 -55
 - data/spec/unit/ridley/resources/role_spec.rb +0 -32
 - metadata +7 -26
 
    
        data/lib/ridley/errors.rb
    CHANGED
    
    
    
        data/lib/ridley/resource.rb
    CHANGED
    
    | 
         @@ -1,17 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Ridley
         
     | 
| 
       2 
2 
     | 
    
         
             
              # @author Jamie Winsor <jamie@vialstudios.com>
         
     | 
| 
       3 
     | 
    
         
            -
               
     | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
       5 
     | 
    
         
            -
                include ActiveModel::AttributeMethods
         
     | 
| 
       6 
     | 
    
         
            -
                include ActiveModel::Validations
         
     | 
| 
       7 
     | 
    
         
            -
                include ActiveModel::Serializers::JSON
         
     | 
| 
       8 
     | 
    
         
            -
                include Comparable
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
                included do
         
     | 
| 
       11 
     | 
    
         
            -
                  attribute_method_suffix('=')
         
     | 
| 
       12 
     | 
    
         
            -
                end
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                module ClassMethods
         
     | 
| 
      
 3 
     | 
    
         
            +
              class Resource
         
     | 
| 
      
 4 
     | 
    
         
            +
                class << self
         
     | 
| 
       15 
5 
     | 
    
         
             
                  # @return [String, nil]
         
     | 
| 
       16 
6 
     | 
    
         
             
                  def chef_id
         
     | 
| 
       17 
7 
     | 
    
         
             
                    @chef_id
         
     | 
| 
         @@ -62,29 +52,6 @@ module Ridley 
     | 
|
| 
       62 
52 
     | 
    
         
             
                    attribute(:json_class, default: klass)
         
     | 
| 
       63 
53 
     | 
    
         
             
                  end
         
     | 
| 
       64 
54 
     | 
    
         | 
| 
       65 
     | 
    
         
            -
                  # @return [Set]
         
     | 
| 
       66 
     | 
    
         
            -
                  def attributes
         
     | 
| 
       67 
     | 
    
         
            -
                    @attributes ||= Set.new
         
     | 
| 
       68 
     | 
    
         
            -
                  end
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                  # @return [Hash]
         
     | 
| 
       71 
     | 
    
         
            -
                  def attribute_defaults
         
     | 
| 
       72 
     | 
    
         
            -
                    @attribute_defaults ||= HashWithIndifferentAccess.new
         
     | 
| 
       73 
     | 
    
         
            -
                  end
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
                  # @param [String, Symbol] name
         
     | 
| 
       76 
     | 
    
         
            -
                  # @option options [Object] :default
         
     | 
| 
       77 
     | 
    
         
            -
                  #   defines the default value for the attribute
         
     | 
| 
       78 
     | 
    
         
            -
                  #
         
     | 
| 
       79 
     | 
    
         
            -
                  # @return [Set]
         
     | 
| 
       80 
     | 
    
         
            -
                  def attribute(name, options = {})
         
     | 
| 
       81 
     | 
    
         
            -
                    if options.has_key?(:default)
         
     | 
| 
       82 
     | 
    
         
            -
                      default_for_attribute(name, options[:default])
         
     | 
| 
       83 
     | 
    
         
            -
                    end
         
     | 
| 
       84 
     | 
    
         
            -
                    define_attribute_method(name)
         
     | 
| 
       85 
     | 
    
         
            -
                    attributes << name.to_sym
         
     | 
| 
       86 
     | 
    
         
            -
                  end
         
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
55 
     | 
    
         
             
                  # @param [Ridley::Connection] connection
         
     | 
| 
       89 
56 
     | 
    
         
             
                  #
         
     | 
| 
       90 
57 
     | 
    
         
             
                  # @return [Array<Object>]
         
     | 
| 
         @@ -164,67 +131,16 @@ module Ridley 
     | 
|
| 
       164 
131 
     | 
    
         
             
                    resource = new(connection, object.to_hash)
         
     | 
| 
       165 
132 
     | 
    
         
             
                    new(connection, connection.put("#{self.resource_path}/#{resource.chef_id}", resource.to_json).body)
         
     | 
| 
       166 
133 
     | 
    
         
             
                  end
         
     | 
| 
       167 
     | 
    
         
            -
             
     | 
| 
       168 
     | 
    
         
            -
                  private
         
     | 
| 
       169 
     | 
    
         
            -
             
     | 
| 
       170 
     | 
    
         
            -
                    def default_for_attribute(name, value)
         
     | 
| 
       171 
     | 
    
         
            -
                      attribute_defaults[name.to_sym] = value
         
     | 
| 
       172 
     | 
    
         
            -
                    end
         
     | 
| 
       173 
134 
     | 
    
         
             
                end
         
     | 
| 
       174 
135 
     | 
    
         | 
| 
      
 136 
     | 
    
         
            +
                include Chozo::VariaModel
         
     | 
| 
      
 137 
     | 
    
         
            +
                include Comparable
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
       175 
139 
     | 
    
         
             
                # @param [Ridley::Connection] connection
         
     | 
| 
       176 
     | 
    
         
            -
                # @param [Hash]  
     | 
| 
       177 
     | 
    
         
            -
                def initialize(connection,  
     | 
| 
      
 140 
     | 
    
         
            +
                # @param [Hash] new_attrs
         
     | 
| 
      
 141 
     | 
    
         
            +
                def initialize(connection, new_attrs = {})
         
     | 
| 
       178 
142 
     | 
    
         
             
                  @connection = connection
         
     | 
| 
       179 
     | 
    
         
            -
                   
     | 
| 
       180 
     | 
    
         
            -
                end
         
     | 
| 
       181 
     | 
    
         
            -
             
     | 
| 
       182 
     | 
    
         
            -
                # @param [String, Symbol] key
         
     | 
| 
       183 
     | 
    
         
            -
                #
         
     | 
| 
       184 
     | 
    
         
            -
                # @return [Object]
         
     | 
| 
       185 
     | 
    
         
            -
                def attribute(key)
         
     | 
| 
       186 
     | 
    
         
            -
                  if instance_variable_defined?("@#{key}")
         
     | 
| 
       187 
     | 
    
         
            -
                    instance_variable_get("@#{key}")
         
     | 
| 
       188 
     | 
    
         
            -
                  else
         
     | 
| 
       189 
     | 
    
         
            -
                    self.class.attribute_defaults[key]
         
     | 
| 
       190 
     | 
    
         
            -
                  end
         
     | 
| 
       191 
     | 
    
         
            -
                end
         
     | 
| 
       192 
     | 
    
         
            -
                alias_method :[], :attribute
         
     | 
| 
       193 
     | 
    
         
            -
             
     | 
| 
       194 
     | 
    
         
            -
                # @param [String, Symbol] key
         
     | 
| 
       195 
     | 
    
         
            -
                # @param [Object] value
         
     | 
| 
       196 
     | 
    
         
            -
                #
         
     | 
| 
       197 
     | 
    
         
            -
                # @return [Object]
         
     | 
| 
       198 
     | 
    
         
            -
                def attribute=(key, value)
         
     | 
| 
       199 
     | 
    
         
            -
                  instance_variable_set("@#{key}", value)
         
     | 
| 
       200 
     | 
    
         
            -
                end
         
     | 
| 
       201 
     | 
    
         
            -
                alias_method :[]=, :attribute=
         
     | 
| 
       202 
     | 
    
         
            -
             
     | 
| 
       203 
     | 
    
         
            -
                # @param [String, Symbol] key
         
     | 
| 
       204 
     | 
    
         
            -
                #
         
     | 
| 
       205 
     | 
    
         
            -
                # @return [Boolean]
         
     | 
| 
       206 
     | 
    
         
            -
                def attribute?(key)
         
     | 
| 
       207 
     | 
    
         
            -
                  attribute(key).present?
         
     | 
| 
       208 
     | 
    
         
            -
                end
         
     | 
| 
       209 
     | 
    
         
            -
             
     | 
| 
       210 
     | 
    
         
            -
                # @return [Hash]
         
     | 
| 
       211 
     | 
    
         
            -
                def attributes
         
     | 
| 
       212 
     | 
    
         
            -
                  {}.tap do |attrs|
         
     | 
| 
       213 
     | 
    
         
            -
                    self.class.attributes.each do |attr|
         
     | 
| 
       214 
     | 
    
         
            -
                      attrs[attr] = attribute(attr)
         
     | 
| 
       215 
     | 
    
         
            -
                    end
         
     | 
| 
       216 
     | 
    
         
            -
                  end
         
     | 
| 
       217 
     | 
    
         
            -
                end
         
     | 
| 
       218 
     | 
    
         
            -
             
     | 
| 
       219 
     | 
    
         
            -
                # @param [#to_hash] new_attributes
         
     | 
| 
       220 
     | 
    
         
            -
                #
         
     | 
| 
       221 
     | 
    
         
            -
                # @return [Hash]
         
     | 
| 
       222 
     | 
    
         
            -
                def attributes=(new_attributes)
         
     | 
| 
       223 
     | 
    
         
            -
                  new_attributes.to_hash.symbolize_keys!
         
     | 
| 
       224 
     | 
    
         
            -
             
     | 
| 
       225 
     | 
    
         
            -
                  self.class.attributes.each do |attr_name|
         
     | 
| 
       226 
     | 
    
         
            -
                    send(:attribute=, attr_name, new_attributes[attr_name.to_sym])
         
     | 
| 
       227 
     | 
    
         
            -
                  end
         
     | 
| 
      
 143 
     | 
    
         
            +
                  mass_assign(new_attrs)
         
     | 
| 
       228 
144 
     | 
    
         
             
                end
         
     | 
| 
       229 
145 
     | 
    
         | 
| 
       230 
146 
     | 
    
         
             
                # Creates a resource on the target remote or updates one if the resource
         
     | 
| 
         @@ -237,7 +153,7 @@ module Ridley 
     | 
|
| 
       237 
153 
     | 
    
         
             
                def save
         
     | 
| 
       238 
154 
     | 
    
         
             
                  raise Errors::InvalidResource.new(self.errors) unless valid?
         
     | 
| 
       239 
155 
     | 
    
         | 
| 
       240 
     | 
    
         
            -
                  self. 
     | 
| 
      
 156 
     | 
    
         
            +
                  mass_assign(self.class.create(connection, self).attributes)
         
     | 
| 
       241 
157 
     | 
    
         
             
                  true
         
     | 
| 
       242 
158 
     | 
    
         
             
                rescue Errors::HTTPConflict
         
     | 
| 
       243 
159 
     | 
    
         
             
                  self.update
         
     | 
| 
         @@ -254,7 +170,7 @@ module Ridley 
     | 
|
| 
       254 
170 
     | 
    
         
             
                def update
         
     | 
| 
       255 
171 
     | 
    
         
             
                  raise Errors::InvalidResource.new(self.errors) unless valid?
         
     | 
| 
       256 
172 
     | 
    
         | 
| 
       257 
     | 
    
         
            -
                  self. 
     | 
| 
      
 173 
     | 
    
         
            +
                  mass_assign(self.class.update(connection, self).attributes)
         
     | 
| 
       258 
174 
     | 
    
         
             
                  true
         
     | 
| 
       259 
175 
     | 
    
         
             
                end
         
     | 
| 
       260 
176 
     | 
    
         | 
| 
         @@ -262,44 +178,13 @@ module Ridley 
     | 
|
| 
       262 
178 
     | 
    
         
             
                #
         
     | 
| 
       263 
179 
     | 
    
         
             
                # @return [Object]
         
     | 
| 
       264 
180 
     | 
    
         
             
                def reload
         
     | 
| 
       265 
     | 
    
         
            -
                  self. 
     | 
| 
      
 181 
     | 
    
         
            +
                  mass_assign(self.class.find(connection, self).attributes)
         
     | 
| 
       266 
182 
     | 
    
         
             
                  self
         
     | 
| 
       267 
183 
     | 
    
         
             
                end
         
     | 
| 
       268 
184 
     | 
    
         | 
| 
       269 
185 
     | 
    
         
             
                # @return [String]
         
     | 
| 
       270 
186 
     | 
    
         
             
                def chef_id
         
     | 
| 
       271 
     | 
    
         
            -
                   
     | 
| 
       272 
     | 
    
         
            -
                end
         
     | 
| 
       273 
     | 
    
         
            -
             
     | 
| 
       274 
     | 
    
         
            -
                # @param [String] json
         
     | 
| 
       275 
     | 
    
         
            -
                # @option options [Boolean] :symbolize_keys
         
     | 
| 
       276 
     | 
    
         
            -
                # @option options [Class, Symbol, String] :adapter
         
     | 
| 
       277 
     | 
    
         
            -
                #
         
     | 
| 
       278 
     | 
    
         
            -
                # @return [Object]
         
     | 
| 
       279 
     | 
    
         
            -
                def from_json(json, options = {})
         
     | 
| 
       280 
     | 
    
         
            -
                  self.attributes = MultiJson.decode(json, options)
         
     | 
| 
       281 
     | 
    
         
            -
                  self
         
     | 
| 
       282 
     | 
    
         
            -
                end
         
     | 
| 
       283 
     | 
    
         
            -
             
     | 
| 
       284 
     | 
    
         
            -
                # @param [#to_hash] hash
         
     | 
| 
       285 
     | 
    
         
            -
                #
         
     | 
| 
       286 
     | 
    
         
            -
                # @return [Object]
         
     | 
| 
       287 
     | 
    
         
            -
                def from_hash(hash)
         
     | 
| 
       288 
     | 
    
         
            -
                  self.attributes = hash.to_hash
         
     | 
| 
       289 
     | 
    
         
            -
                  self
         
     | 
| 
       290 
     | 
    
         
            -
                end
         
     | 
| 
       291 
     | 
    
         
            -
             
     | 
| 
       292 
     | 
    
         
            -
                # @option options [Boolean] :symbolize_keys
         
     | 
| 
       293 
     | 
    
         
            -
                # @option options [Class, Symbol, String] :adapter
         
     | 
| 
       294 
     | 
    
         
            -
                #
         
     | 
| 
       295 
     | 
    
         
            -
                # @return [String]
         
     | 
| 
       296 
     | 
    
         
            -
                def to_json(options = {})
         
     | 
| 
       297 
     | 
    
         
            -
                  MultiJson.encode(self.attributes, options)
         
     | 
| 
       298 
     | 
    
         
            -
                end
         
     | 
| 
       299 
     | 
    
         
            -
                alias_method :as_json, :to_json
         
     | 
| 
       300 
     | 
    
         
            -
             
     | 
| 
       301 
     | 
    
         
            -
                def to_hash
         
     | 
| 
       302 
     | 
    
         
            -
                  self.attributes
         
     | 
| 
      
 187 
     | 
    
         
            +
                  get_attribute(self.class.chef_id)
         
     | 
| 
       303 
188 
     | 
    
         
             
                end
         
     | 
| 
       304 
189 
     | 
    
         | 
| 
       305 
190 
     | 
    
         
             
                def to_s
         
     | 
| 
         @@ -1,8 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Ridley
         
     | 
| 
       2 
2 
     | 
    
         
             
              # @author Jamie Winsor <jamie@vialstudios.com>
         
     | 
| 
       3 
     | 
    
         
            -
              class Client
         
     | 
| 
       4 
     | 
    
         
            -
                include Ridley::Resource
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
              class Client < Ridley::Resource
         
     | 
| 
       6 
4 
     | 
    
         
             
                class << self
         
     | 
| 
       7 
5 
     | 
    
         
             
                  # Retrieves a client from the remote connection matching the given chef_id
         
     | 
| 
       8 
6 
     | 
    
         
             
                  # and regenerates it's private key. An instance of the updated object will
         
     | 
| 
         @@ -28,25 +26,31 @@ module Ridley 
     | 
|
| 
       28 
26 
     | 
    
         
             
                set_chef_json_class "Chef::ApiClient"
         
     | 
| 
       29 
27 
     | 
    
         
             
                set_resource_path "clients"
         
     | 
| 
       30 
28 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
                attribute :name
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
      
 29 
     | 
    
         
            +
                attribute :name,
         
     | 
| 
      
 30 
     | 
    
         
            +
                  type: String,
         
     | 
| 
      
 31 
     | 
    
         
            +
                  required: true
         
     | 
| 
       33 
32 
     | 
    
         | 
| 
       34 
     | 
    
         
            -
                attribute :admin, 
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
      
 33 
     | 
    
         
            +
                attribute :admin,
         
     | 
| 
      
 34 
     | 
    
         
            +
                  type: Boolean,
         
     | 
| 
      
 35 
     | 
    
         
            +
                  required: true,
         
     | 
| 
      
 36 
     | 
    
         
            +
                  default: false
         
     | 
| 
       36 
37 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
                attribute :validator, 
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
      
 38 
     | 
    
         
            +
                attribute :validator,
         
     | 
| 
      
 39 
     | 
    
         
            +
                  type: Boolean,
         
     | 
| 
      
 40 
     | 
    
         
            +
                  required: true,
         
     | 
| 
      
 41 
     | 
    
         
            +
                  default: false
         
     | 
| 
       39 
42 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
                attribute :certificate
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                attribute :private_key
         
     | 
| 
       43 
     | 
    
         
            -
                attribute :orgname
         
     | 
| 
      
 43 
     | 
    
         
            +
                attribute :certificate,
         
     | 
| 
      
 44 
     | 
    
         
            +
                  type: String
         
     | 
| 
       44 
45 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
                 
     | 
| 
       46 
     | 
    
         
            -
                   
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
      
 46 
     | 
    
         
            +
                attribute :public_key,
         
     | 
| 
      
 47 
     | 
    
         
            +
                  type: String
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                attribute :private_key,
         
     | 
| 
      
 50 
     | 
    
         
            +
                  type: [ String, Boolean ]
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                attribute :orgname,
         
     | 
| 
      
 53 
     | 
    
         
            +
                  type: String
         
     | 
| 
       50 
54 
     | 
    
         | 
| 
       51 
55 
     | 
    
         
             
                # Regenerates the private key of the instantiated client object. The new
         
     | 
| 
       52 
56 
     | 
    
         
             
                # private key will be set to the value of the 'private_key' accessor
         
     | 
| 
         @@ -58,6 +62,16 @@ module Ridley 
     | 
|
| 
       58 
62 
     | 
    
         
             
                  self.private_key = true
         
     | 
| 
       59 
63 
     | 
    
         
             
                  self.save
         
     | 
| 
       60 
64 
     | 
    
         
             
                end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                # Override to_json to reflect to massage the returned attributes based on the type
         
     | 
| 
      
 67 
     | 
    
         
            +
                # of connection. Only OHC/OPC requires the json_class attribute is not present.
         
     | 
| 
      
 68 
     | 
    
         
            +
                def to_json
         
     | 
| 
      
 69 
     | 
    
         
            +
                  if connection.hosted?
         
     | 
| 
      
 70 
     | 
    
         
            +
                    attributes.except(:json_class).to_json
         
     | 
| 
      
 71 
     | 
    
         
            +
                  else
         
     | 
| 
      
 72 
     | 
    
         
            +
                    super
         
     | 
| 
      
 73 
     | 
    
         
            +
                  end
         
     | 
| 
      
 74 
     | 
    
         
            +
                end
         
     | 
| 
       61 
75 
     | 
    
         
             
              end
         
     | 
| 
       62 
76 
     | 
    
         | 
| 
       63 
77 
     | 
    
         
             
              module DSL
         
     | 
| 
         @@ -1,8 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Ridley
         
     | 
| 
       2 
2 
     | 
    
         
             
              # @author Jamie Winsor <jamie@vialstudios.com>
         
     | 
| 
       3 
     | 
    
         
            -
              class Cookbook 
     | 
| 
       4 
     | 
    
         
            -
                include Ridley::Resource
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
              class Cookbook < Ridley::Resource
         
     | 
| 
       6 
4 
     | 
    
         
             
                class << self
         
     | 
| 
       7 
5 
     | 
    
         
             
                  # Save a new Cookbook Version of the given name, version with the
         
     | 
| 
       8 
6 
     | 
    
         
             
                  # given manifest of files and checksums.
         
     | 
| 
         @@ -34,8 +32,8 @@ module Ridley 
     | 
|
| 
       34 
32 
     | 
    
         
             
                set_chef_json_class "Chef::Cookbook"
         
     | 
| 
       35 
33 
     | 
    
         
             
                set_resource_path "cookbooks"
         
     | 
| 
       36 
34 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
                attribute :name
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
      
 35 
     | 
    
         
            +
                attribute :name,
         
     | 
| 
      
 36 
     | 
    
         
            +
                  required: true
         
     | 
| 
       39 
37 
     | 
    
         
             
              end
         
     | 
| 
       40 
38 
     | 
    
         | 
| 
       41 
39 
     | 
    
         
             
              module DSL
         
     | 
| 
         @@ -25,9 +25,7 @@ module Ridley 
     | 
|
| 
       25 
25 
     | 
    
         
             
              end
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
              # @author Jamie Winsor <jamie@vialstudios.com>
         
     | 
| 
       28 
     | 
    
         
            -
              class DataBag
         
     | 
| 
       29 
     | 
    
         
            -
                include Ridley::Resource
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
      
 28 
     | 
    
         
            +
              class DataBag < Ridley::Resource
         
     | 
| 
       31 
29 
     | 
    
         
             
                class << self
         
     | 
| 
       32 
30 
     | 
    
         
             
                  # @param [Ridley::Connection] connection
         
     | 
| 
       33 
31 
     | 
    
         
             
                  # @param [String, #chef_id] object
         
     | 
| 
         @@ -56,8 +54,8 @@ module Ridley 
     | 
|
| 
       56 
54 
     | 
    
         
             
                set_chef_id "name"
         
     | 
| 
       57 
55 
     | 
    
         
             
                set_resource_path "data"
         
     | 
| 
       58 
56 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
                attribute :name
         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
      
 57 
     | 
    
         
            +
                attribute :name,
         
     | 
| 
      
 58 
     | 
    
         
            +
                  required: true
         
     | 
| 
       61 
59 
     | 
    
         | 
| 
       62 
60 
     | 
    
         
             
                def item
         
     | 
| 
       63 
61 
     | 
    
         
             
                  DBIChainLink.new(self, connection)
         
     | 
| 
         @@ -1,9 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Ridley
         
     | 
| 
       2 
2 
     | 
    
         
             
              # @author Jamie Winsor <jamie@vialstudios.com>
         
     | 
| 
       3 
     | 
    
         
            -
              class DataBagItem
         
     | 
| 
       4 
     | 
    
         
            -
                include ActiveModel::Validations
         
     | 
| 
       5 
     | 
    
         
            -
                include ActiveModel::Serialization
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
              class DataBagItem < Ridley::Resource
         
     | 
| 
       7 
4 
     | 
    
         
             
                class << self
         
     | 
| 
       8 
5 
     | 
    
         
             
                  # @param [Ridley::Connection] connection
         
     | 
| 
       9 
6 
     | 
    
         
             
                  #
         
     | 
| 
         @@ -98,52 +95,28 @@ module Ridley 
     | 
|
| 
       98 
95 
     | 
    
         
             
                  end
         
     | 
| 
       99 
96 
     | 
    
         
             
                end
         
     | 
| 
       100 
97 
     | 
    
         | 
| 
      
 98 
     | 
    
         
            +
                set_assignment_mode :carefree
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
       101 
100 
     | 
    
         
             
                # @return [Ridley::DataBag]
         
     | 
| 
       102 
101 
     | 
    
         
             
                attr_reader :data_bag
         
     | 
| 
       103 
     | 
    
         
            -
                # @return [HashWithIndifferentAccess]
         
     | 
| 
       104 
     | 
    
         
            -
                attr_reader :attributes
         
     | 
| 
       105 
102 
     | 
    
         | 
| 
       106 
     | 
    
         
            -
                 
     | 
| 
      
 103 
     | 
    
         
            +
                attribute :id,
         
     | 
| 
      
 104 
     | 
    
         
            +
                  type: String,
         
     | 
| 
      
 105 
     | 
    
         
            +
                  required: true
         
     | 
| 
       107 
106 
     | 
    
         | 
| 
       108 
107 
     | 
    
         
             
                # @param [Ridley::Connection] connection
         
     | 
| 
       109 
108 
     | 
    
         
             
                # @param [Ridley::DataBag] data_bag
         
     | 
| 
       110 
     | 
    
         
            -
                # @param [#to_hash]  
     | 
| 
       111 
     | 
    
         
            -
                def initialize(connection, data_bag,  
     | 
| 
       112 
     | 
    
         
            -
                   
     | 
| 
      
 109 
     | 
    
         
            +
                # @param [#to_hash] new_attrs
         
     | 
| 
      
 110 
     | 
    
         
            +
                def initialize(connection, data_bag, new_attrs = {})
         
     | 
| 
      
 111 
     | 
    
         
            +
                  super(connection, new_attrs)
         
     | 
| 
       113 
112 
     | 
    
         
             
                  @data_bag = data_bag
         
     | 
| 
       114 
     | 
    
         
            -
                  self.attributes = attributes
         
     | 
| 
       115 
113 
     | 
    
         
             
                end
         
     | 
| 
       116 
114 
     | 
    
         | 
| 
       117 
115 
     | 
    
         
             
                # Alias for accessing the value of the 'id' attribute
         
     | 
| 
       118 
116 
     | 
    
         
             
                #
         
     | 
| 
       119 
117 
     | 
    
         
             
                # @return [String]
         
     | 
| 
       120 
118 
     | 
    
         
             
                def chef_id
         
     | 
| 
       121 
     | 
    
         
            -
                   
     | 
| 
       122 
     | 
    
         
            -
                end
         
     | 
| 
       123 
     | 
    
         
            -
                alias_method :id, :chef_id
         
     | 
| 
       124 
     | 
    
         
            -
             
     | 
| 
       125 
     | 
    
         
            -
                # @param [String, Symbol] key
         
     | 
| 
       126 
     | 
    
         
            -
                #
         
     | 
| 
       127 
     | 
    
         
            -
                # @return [Object]
         
     | 
| 
       128 
     | 
    
         
            -
                def attribute(key)
         
     | 
| 
       129 
     | 
    
         
            -
                  @attributes[key]
         
     | 
| 
       130 
     | 
    
         
            -
                end
         
     | 
| 
       131 
     | 
    
         
            -
                alias_method :[], :attribute
         
     | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
       133 
     | 
    
         
            -
                # @param [String, Symbol] key
         
     | 
| 
       134 
     | 
    
         
            -
                # @param [Object] value
         
     | 
| 
       135 
     | 
    
         
            -
                #
         
     | 
| 
       136 
     | 
    
         
            -
                # @return [Object]
         
     | 
| 
       137 
     | 
    
         
            -
                def attribute=(key, value)
         
     | 
| 
       138 
     | 
    
         
            -
                  @attributes[key] = value
         
     | 
| 
       139 
     | 
    
         
            -
                end
         
     | 
| 
       140 
     | 
    
         
            -
                alias_method :[]=, :attribute=
         
     | 
| 
       141 
     | 
    
         
            -
             
     | 
| 
       142 
     | 
    
         
            -
                # @param [#to_hash] new_attributes
         
     | 
| 
       143 
     | 
    
         
            -
                #
         
     | 
| 
       144 
     | 
    
         
            -
                # @return [HashWithIndifferentAccess]
         
     | 
| 
       145 
     | 
    
         
            -
                def attributes=(new_attributes)
         
     | 
| 
       146 
     | 
    
         
            -
                  @attributes = HashWithIndifferentAccess.new(new_attributes.to_hash)
         
     | 
| 
      
 119 
     | 
    
         
            +
                  get_attribute(:id)
         
     | 
| 
       147 
120 
     | 
    
         
             
                end
         
     | 
| 
       148 
121 
     | 
    
         | 
| 
       149 
122 
     | 
    
         
             
                # Creates a resource on the target remote or updates one if the resource
         
     | 
| 
         @@ -157,10 +130,10 @@ module Ridley 
     | 
|
| 
       157 
130 
     | 
    
         
             
                def save
         
     | 
| 
       158 
131 
     | 
    
         
             
                  raise Errors::InvalidResource.new(self.errors) unless valid?
         
     | 
| 
       159 
132 
     | 
    
         | 
| 
       160 
     | 
    
         
            -
                  self. 
     | 
| 
      
 133 
     | 
    
         
            +
                  mass_assign(self.class.create(connection, data_bag, self).attributes)
         
     | 
| 
       161 
134 
     | 
    
         
             
                  true
         
     | 
| 
       162 
135 
     | 
    
         
             
                rescue Errors::HTTPConflict
         
     | 
| 
       163 
     | 
    
         
            -
                  self. 
     | 
| 
      
 136 
     | 
    
         
            +
                  self.update
         
     | 
| 
       164 
137 
     | 
    
         
             
                  true
         
     | 
| 
       165 
138 
     | 
    
         
             
                end
         
     | 
| 
       166 
139 
     | 
    
         | 
| 
         @@ -169,7 +142,7 @@ module Ridley 
     | 
|
| 
       169 
142 
     | 
    
         
             
                # @return [Hash] decrypted attributes
         
     | 
| 
       170 
143 
     | 
    
         
             
                def decrypt
         
     | 
| 
       171 
144 
     | 
    
         
             
                  decrypted_hash = Hash[attributes.map { |key, value| [key, key == "id" ? value : decrypt_value(value)] }]
         
     | 
| 
       172 
     | 
    
         
            -
                   
     | 
| 
      
 145 
     | 
    
         
            +
                  mass_assign(decrypted_hash)
         
     | 
| 
       173 
146 
     | 
    
         
             
                end
         
     | 
| 
       174 
147 
     | 
    
         | 
| 
       175 
148 
     | 
    
         
             
                def decrypt_value(value)
         
     | 
| 
         @@ -183,27 +156,36 @@ module Ridley 
     | 
|
| 
       183 
156 
     | 
    
         
             
                  YAML.load(decrypted_value)
         
     | 
| 
       184 
157 
     | 
    
         
             
                end
         
     | 
| 
       185 
158 
     | 
    
         | 
| 
       186 
     | 
    
         
            -
                #  
     | 
| 
      
 159 
     | 
    
         
            +
                # Reload the attributes of the instantiated resource
         
     | 
| 
       187 
160 
     | 
    
         
             
                #
         
     | 
| 
       188 
161 
     | 
    
         
             
                # @return [Object]
         
     | 
| 
       189 
     | 
    
         
            -
                def  
     | 
| 
       190 
     | 
    
         
            -
                   
     | 
| 
       191 
     | 
    
         
            -
             
     | 
| 
       192 
     | 
    
         
            -
                  self.attributes = hash.has_key?(:raw_data) ? hash[:raw_data] : hash
         
     | 
| 
      
 162 
     | 
    
         
            +
                def reload
         
     | 
| 
      
 163 
     | 
    
         
            +
                  mass_assign(self.class.find(connection, data_bag, self).attributes)
         
     | 
| 
       193 
164 
     | 
    
         
             
                  self
         
     | 
| 
       194 
165 
     | 
    
         
             
                end
         
     | 
| 
       195 
166 
     | 
    
         | 
| 
       196 
     | 
    
         
            -
                #  
     | 
| 
       197 
     | 
    
         
            -
                #  
     | 
| 
      
 167 
     | 
    
         
            +
                # Updates the instantiated resource on the target remote with any changes made
         
     | 
| 
      
 168 
     | 
    
         
            +
                # to self
         
     | 
| 
       198 
169 
     | 
    
         
             
                #
         
     | 
| 
       199 
     | 
    
         
            -
                # @ 
     | 
| 
       200 
     | 
    
         
            -
                 
     | 
| 
       201 
     | 
    
         
            -
             
     | 
| 
      
 170 
     | 
    
         
            +
                # @raise [Errors::InvalidResource]
         
     | 
| 
      
 171 
     | 
    
         
            +
                #   if the resource does not pass validations
         
     | 
| 
      
 172 
     | 
    
         
            +
                #
         
     | 
| 
      
 173 
     | 
    
         
            +
                # @return [Boolean]
         
     | 
| 
      
 174 
     | 
    
         
            +
                def update
         
     | 
| 
      
 175 
     | 
    
         
            +
                  raise Errors::InvalidResource.new(self.errors) unless valid?
         
     | 
| 
      
 176 
     | 
    
         
            +
             
     | 
| 
      
 177 
     | 
    
         
            +
                  mass_assign(sself.class.update(connection, data_bag, self).attributes)
         
     | 
| 
      
 178 
     | 
    
         
            +
                  true
         
     | 
| 
       202 
179 
     | 
    
         
             
                end
         
     | 
| 
       203 
     | 
    
         
            -
                alias_method :as_json, :to_json
         
     | 
| 
       204 
180 
     | 
    
         | 
| 
       205 
     | 
    
         
            -
                 
     | 
| 
       206 
     | 
    
         
            -
             
     | 
| 
      
 181 
     | 
    
         
            +
                # @param [#to_hash] hash
         
     | 
| 
      
 182 
     | 
    
         
            +
                #
         
     | 
| 
      
 183 
     | 
    
         
            +
                # @return [Object]
         
     | 
| 
      
 184 
     | 
    
         
            +
                def from_hash(hash)
         
     | 
| 
      
 185 
     | 
    
         
            +
                  hash = HashWithIndifferentAccess.new(hash.to_hash)
         
     | 
| 
      
 186 
     | 
    
         
            +
             
     | 
| 
      
 187 
     | 
    
         
            +
                  mass_assign(hash.has_key?(:raw_data) ? hash[:raw_data] : hash)
         
     | 
| 
      
 188 
     | 
    
         
            +
                  self
         
     | 
| 
       207 
189 
     | 
    
         
             
                end
         
     | 
| 
       208 
190 
     | 
    
         | 
| 
       209 
191 
     | 
    
         
             
                def to_s
         
     | 
| 
         @@ -1,8 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Ridley
         
     | 
| 
       2 
2 
     | 
    
         
             
              # @author Jamie Winsor <jamie@vialstudios.com>
         
     | 
| 
       3 
     | 
    
         
            -
              class Environment
         
     | 
| 
       4 
     | 
    
         
            -
                include Ridley::Resource
         
     | 
| 
       5 
     | 
    
         
            -
                
         
     | 
| 
      
 3 
     | 
    
         
            +
              class Environment < Ridley::Resource    
         
     | 
| 
       6 
4 
     | 
    
         
             
                class << self
         
     | 
| 
       7 
5 
     | 
    
         
             
                  # Delete all of the environments on the remote connection. The
         
     | 
| 
       8 
6 
     | 
    
         
             
                  # '_default' environment will never be deleted.
         
     | 
| 
         @@ -21,27 +19,20 @@ module Ridley 
     | 
|
| 
       21 
19 
     | 
    
         
             
                set_chef_json_class "Chef::Environment"
         
     | 
| 
       22 
20 
     | 
    
         
             
                set_resource_path "environments"
         
     | 
| 
       23 
21 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                attribute :name
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                attribute :description, default: String.new
         
     | 
| 
       28 
     | 
    
         
            -
                attribute :default_attributes, default: HashWithIndifferentAccess.new
         
     | 
| 
       29 
     | 
    
         
            -
                attribute :override_attributes, default: HashWithIndifferentAccess.new
         
     | 
| 
       30 
     | 
    
         
            -
                attribute :cookbook_versions, default: HashWithIndifferentAccess.new
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                # @param [Hash] hash
         
     | 
| 
       33 
     | 
    
         
            -
                def default_attributes=(hash)
         
     | 
| 
       34 
     | 
    
         
            -
                  super(HashWithIndifferentAccess.new(hash))
         
     | 
| 
       35 
     | 
    
         
            -
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
                attribute :name,
         
     | 
| 
      
 23 
     | 
    
         
            +
                  required: true
         
     | 
| 
       36 
24 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
                 
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                  super(HashWithIndifferentAccess.new(hash))
         
     | 
| 
       40 
     | 
    
         
            -
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
                attribute :description,
         
     | 
| 
      
 26 
     | 
    
         
            +
                  default: String.new
         
     | 
| 
       41 
27 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
                 
     | 
| 
       43 
     | 
    
         
            -
                   
     | 
| 
       44 
     | 
    
         
            -
                 
     | 
| 
      
 28 
     | 
    
         
            +
                attribute :default_attributes,
         
     | 
| 
      
 29 
     | 
    
         
            +
                  default: Hashie::Mash.new
         
     | 
| 
      
 30 
     | 
    
         
            +
                
         
     | 
| 
      
 31 
     | 
    
         
            +
                attribute :override_attributes,
         
     | 
| 
      
 32 
     | 
    
         
            +
                  default: Hashie::Mash.new
         
     | 
| 
      
 33 
     | 
    
         
            +
                
         
     | 
| 
      
 34 
     | 
    
         
            +
                attribute :cookbook_versions,
         
     | 
| 
      
 35 
     | 
    
         
            +
                  default: Hashie::Mash.new
         
     | 
| 
       45 
36 
     | 
    
         | 
| 
       46 
37 
     | 
    
         
             
                # Set an environment level default attribute given the dotted path representation of
         
     | 
| 
       47 
38 
     | 
    
         
             
                # the Chef attribute and value
         
     | 
| 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Ridley 
         
     | 
| 
       2 
2 
     | 
    
         
             
              # @author Jamie Winsor <jamie@vialstudios.com>
         
     | 
| 
       3 
     | 
    
         
            -
              class Node
         
     | 
| 
      
 3 
     | 
    
         
            +
              class Node < Ridley::Resource
         
     | 
| 
       4 
4 
     | 
    
         
             
                class << self
         
     | 
| 
       5 
5 
     | 
    
         
             
                  # @overload bootstrap(connection, nodes, options = {})
         
     | 
| 
       6 
6 
     | 
    
         
             
                  #   @param [Ridley::Connection] connection
         
     | 
| 
         @@ -68,50 +68,40 @@ module Ridley 
     | 
|
| 
       68 
68 
     | 
    
         
             
                  end
         
     | 
| 
       69 
69 
     | 
    
         
             
                end
         
     | 
| 
       70 
70 
     | 
    
         | 
| 
       71 
     | 
    
         
            -
                include Ridley::Resource
         
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
71 
     | 
    
         
             
                set_chef_id "name"
         
     | 
| 
       74 
72 
     | 
    
         
             
                set_chef_type "node"
         
     | 
| 
       75 
73 
     | 
    
         
             
                set_chef_json_class "Chef::Node"
         
     | 
| 
       76 
74 
     | 
    
         
             
                set_resource_path "nodes"
         
     | 
| 
       77 
75 
     | 
    
         | 
| 
       78 
     | 
    
         
            -
                attribute :name
         
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
      
 76 
     | 
    
         
            +
                attribute :name,
         
     | 
| 
      
 77 
     | 
    
         
            +
                  required: true
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
                attribute :chef_environment,
         
     | 
| 
      
 80 
     | 
    
         
            +
                  default: "_default"
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
                attribute :automatic,
         
     | 
| 
      
 83 
     | 
    
         
            +
                  default: Hashie::Mash.new
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
                attribute :normal,
         
     | 
| 
      
 86 
     | 
    
         
            +
                  default: Hashie::Mash.new
         
     | 
| 
       80 
87 
     | 
    
         | 
| 
       81 
     | 
    
         
            -
                attribute : 
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
                attribute : 
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
      
 88 
     | 
    
         
            +
                attribute :default,
         
     | 
| 
      
 89 
     | 
    
         
            +
                  default: Hashie::Mash.new
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
                attribute :override,
         
     | 
| 
      
 92 
     | 
    
         
            +
                  default: Hashie::Mash.new
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
                attribute :run_list,
         
     | 
| 
      
 95 
     | 
    
         
            +
                  default: Array.new
         
     | 
| 
       87 
96 
     | 
    
         | 
| 
       88 
97 
     | 
    
         
             
                alias_method :normal_attributes, :normal
         
     | 
| 
       89 
98 
     | 
    
         
             
                alias_method :automatic_attributes, :automatic
         
     | 
| 
       90 
99 
     | 
    
         
             
                alias_method :default_attributes, :default
         
     | 
| 
       91 
100 
     | 
    
         
             
                alias_method :override_attributes, :override
         
     | 
| 
       92 
101 
     | 
    
         | 
| 
       93 
     | 
    
         
            -
                # @param [Hash] hash
         
     | 
| 
       94 
     | 
    
         
            -
                def normal=(hash)
         
     | 
| 
       95 
     | 
    
         
            -
                  super(HashWithIndifferentAccess.new(hash))
         
     | 
| 
       96 
     | 
    
         
            -
                end
         
     | 
| 
       97 
102 
     | 
    
         
             
                alias_method :normal_attributes=, :normal=
         
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
                # @param [Hash] hash
         
     | 
| 
       100 
     | 
    
         
            -
                def automatic=(hash)
         
     | 
| 
       101 
     | 
    
         
            -
                  super(HashWithIndifferentAccess.new(hash))
         
     | 
| 
       102 
     | 
    
         
            -
                end
         
     | 
| 
       103 
103 
     | 
    
         
             
                alias_method :automatic_attributes=, :automatic=
         
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
                # @param [Hash] hash
         
     | 
| 
       106 
     | 
    
         
            -
                def default=(hash)
         
     | 
| 
       107 
     | 
    
         
            -
                  super(HashWithIndifferentAccess.new(hash))
         
     | 
| 
       108 
     | 
    
         
            -
                end
         
     | 
| 
       109 
104 
     | 
    
         
             
                alias_method :default_attributes=, :default=
         
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
                # @param [Hash] hash
         
     | 
| 
       112 
     | 
    
         
            -
                def override=(hash)
         
     | 
| 
       113 
     | 
    
         
            -
                  super(HashWithIndifferentAccess.new(hash))
         
     | 
| 
       114 
     | 
    
         
            -
                end
         
     | 
| 
       115 
105 
     | 
    
         
             
                alias_method :override_attributes=, :override=
         
     | 
| 
       116 
106 
     | 
    
         | 
| 
       117 
107 
     | 
    
         
             
                # Set a node level normal attribute given the dotted path representation of the Chef
         
     | 
| 
         @@ -123,14 +113,14 @@ module Ridley 
     | 
|
| 
       123 
113 
     | 
    
         
             
                # @example setting and saving a node level normal attribute
         
     | 
| 
       124 
114 
     | 
    
         
             
                #
         
     | 
| 
       125 
115 
     | 
    
         
             
                #   obj = node.find("jwinsor-1")
         
     | 
| 
       126 
     | 
    
         
            -
                #   obj. 
     | 
| 
      
 116 
     | 
    
         
            +
                #   obj.set_chef_attribute("my_app.billing.enabled", false)
         
     | 
| 
       127 
117 
     | 
    
         
             
                #   obj.save
         
     | 
| 
       128 
118 
     | 
    
         
             
                #
         
     | 
| 
       129 
119 
     | 
    
         
             
                # @param [String] key
         
     | 
| 
       130 
120 
     | 
    
         
             
                # @param [Object] value
         
     | 
| 
       131 
121 
     | 
    
         
             
                #
         
     | 
| 
       132 
122 
     | 
    
         
             
                # @return [HashWithIndifferentAccess]
         
     | 
| 
       133 
     | 
    
         
            -
                def  
     | 
| 
      
 123 
     | 
    
         
            +
                def set_chef_attribute(key, value)
         
     | 
| 
       134 
124 
     | 
    
         
             
                  attr_hash = HashWithIndifferentAccess.from_dotted_path(key, value)
         
     | 
| 
       135 
125 
     | 
    
         
             
                  self.normal = self.normal.deep_merge(attr_hash)
         
     | 
| 
       136 
126 
     | 
    
         
             
                end
         
     | 
| 
         @@ -1,31 +1,28 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Ridley
         
     | 
| 
       2 
2 
     | 
    
         
             
              # @author Jamie Winsor <jamie@vialstudios.com>
         
     | 
| 
       3 
     | 
    
         
            -
              class Role
         
     | 
| 
       4 
     | 
    
         
            -
                include Ridley::Resource
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
              class Role < Ridley::Resource
         
     | 
| 
       6 
4 
     | 
    
         
             
                set_chef_id "name"
         
     | 
| 
       7 
5 
     | 
    
         
             
                set_chef_type "role"
         
     | 
| 
       8 
6 
     | 
    
         
             
                set_chef_json_class "Chef::Role"
         
     | 
| 
       9 
7 
     | 
    
         
             
                set_resource_path "roles"
         
     | 
| 
       10 
8 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                attribute :name
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
      
 9 
     | 
    
         
            +
                attribute :name,
         
     | 
| 
      
 10 
     | 
    
         
            +
                  required: true
         
     | 
| 
       13 
11 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
                attribute :description, 
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                attribute :override_attributes, default: HashWithIndifferentAccess.new
         
     | 
| 
       17 
     | 
    
         
            -
                attribute :run_list, default: Array.new
         
     | 
| 
       18 
     | 
    
         
            -
                attribute :env_run_lists, default: Hash.new
         
     | 
| 
      
 12 
     | 
    
         
            +
                attribute :description,
         
     | 
| 
      
 13 
     | 
    
         
            +
                  default: String.new
         
     | 
| 
       19 
14 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
                 
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                  super(HashWithIndifferentAccess.new(hash))
         
     | 
| 
       23 
     | 
    
         
            -
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
                attribute :default_attributes,
         
     | 
| 
      
 16 
     | 
    
         
            +
                  default: Hashie::Mash.new
         
     | 
| 
       24 
17 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                 
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                 
     | 
| 
      
 18 
     | 
    
         
            +
                attribute :override_attributes,
         
     | 
| 
      
 19 
     | 
    
         
            +
                  default: Hashie::Mash.new
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                attribute :run_list,
         
     | 
| 
      
 22 
     | 
    
         
            +
                  default: Array.new
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                attribute :env_run_lists,
         
     | 
| 
      
 25 
     | 
    
         
            +
                  default: Hash.new
         
     | 
| 
       29 
26 
     | 
    
         | 
| 
       30 
27 
     | 
    
         
             
                # Set a role level override attribute given the dotted path representation of the Chef
         
     | 
| 
       31 
28 
     | 
    
         
             
                # attribute and value
         
     | 
    
        data/lib/ridley/version.rb
    CHANGED
    
    
    
        data/lib/ridley.rb
    CHANGED
    
    
    
        data/ridley.gemspec
    CHANGED
    
    | 
         @@ -19,12 +19,11 @@ Gem::Specification.new do |s| 
     | 
|
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
              s.add_runtime_dependency 'json', '>= 1.5.0'
         
     | 
| 
       21 
21 
     | 
    
         
             
              s.add_runtime_dependency 'multi_json', '>= 1.0.4'
         
     | 
| 
       22 
     | 
    
         
            -
              s.add_runtime_dependency 'chozo', '>= 0. 
     | 
| 
      
 22 
     | 
    
         
            +
              s.add_runtime_dependency 'chozo', '>= 0.4.1'
         
     | 
| 
       23 
23 
     | 
    
         
             
              s.add_runtime_dependency 'mixlib-log'
         
     | 
| 
       24 
24 
     | 
    
         
             
              s.add_runtime_dependency 'mixlib-authentication'
         
     | 
| 
       25 
25 
     | 
    
         
             
              s.add_runtime_dependency 'addressable'
         
     | 
| 
       26 
26 
     | 
    
         
             
              s.add_runtime_dependency 'faraday'
         
     | 
| 
       27 
     | 
    
         
            -
              s.add_runtime_dependency 'activemodel', '>= 3.2.0'
         
     | 
| 
       28 
27 
     | 
    
         
             
              s.add_runtime_dependency 'activesupport', '>= 3.2.0'
         
     | 
| 
       29 
28 
     | 
    
         
             
              s.add_runtime_dependency 'celluloid'
         
     | 
| 
       30 
29 
     | 
    
         
             
              s.add_runtime_dependency 'net-ssh'
         
     | 
| 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            shared_examples_for "a Ridley Resource" do |resource_klass|
         
     | 
| 
       2 
     | 
    
         
            -
              let(:connection) { double('connection') }
         
     | 
| 
      
 2 
     | 
    
         
            +
              let(:connection) { double('connection', hosted?: true) }
         
     | 
| 
       3 
3 
     | 
    
         
             
              let(:active_connection) { double('active-connection') }
         
     | 
| 
       4 
4 
     | 
    
         
             
              let(:response) { double('response') }
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
         @@ -99,40 +99,6 @@ shared_examples_for "a Ridley Resource" do |resource_klass| 
     | 
|
| 
       99 
99 
     | 
    
         | 
| 
       100 
100 
     | 
    
         
             
              subject { resource_klass.new(connection) }
         
     | 
| 
       101 
101 
     | 
    
         | 
| 
       102 
     | 
    
         
            -
              describe "#attribute" do
         
     | 
| 
       103 
     | 
    
         
            -
                it "returns the value of the attribute of the corresponding identifier" do
         
     | 
| 
       104 
     | 
    
         
            -
                  subject.attributes.each do |attr, value|
         
     | 
| 
       105 
     | 
    
         
            -
                    subject.attribute(attr).should eql(value)
         
     | 
| 
       106 
     | 
    
         
            -
                  end
         
     | 
| 
       107 
     | 
    
         
            -
                end
         
     | 
| 
       108 
     | 
    
         
            -
              end
         
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
     | 
    
         
            -
              describe "#attribute=" do
         
     | 
| 
       111 
     | 
    
         
            -
                it "assigns the desired to the attribute of the corresponding identifier" do
         
     | 
| 
       112 
     | 
    
         
            -
                  subject.attributes.each do |attr, value|
         
     | 
| 
       113 
     | 
    
         
            -
                    subject.send(:attribute=, attr, "testval")
         
     | 
| 
       114 
     | 
    
         
            -
                  end
         
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
                  subject.attributes.each do |attr, value|
         
     | 
| 
       117 
     | 
    
         
            -
                    subject.attribute(attr).should eql("testval")
         
     | 
| 
       118 
     | 
    
         
            -
                  end
         
     | 
| 
       119 
     | 
    
         
            -
                end
         
     | 
| 
       120 
     | 
    
         
            -
              end
         
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
     | 
    
         
            -
              describe "#attributes" do
         
     | 
| 
       123 
     | 
    
         
            -
                it "returns a hash of attributes" do
         
     | 
| 
       124 
     | 
    
         
            -
                  subject.attributes.should be_a(Hash)
         
     | 
| 
       125 
     | 
    
         
            -
                end
         
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       127 
     | 
    
         
            -
                it "includes attribute_defaults in the attributes" do
         
     | 
| 
       128 
     | 
    
         
            -
                  subject.class.stub(:attributes).and_return(Set.new([:val_one]))
         
     | 
| 
       129 
     | 
    
         
            -
                  subject.class.stub(:attribute_defaults).and_return(val_one: "value")
         
     | 
| 
       130 
     | 
    
         
            -
             
     | 
| 
       131 
     | 
    
         
            -
                  subject.attributes.should have_key(:val_one)
         
     | 
| 
       132 
     | 
    
         
            -
                  subject.attributes[:val_one].should eql("value")
         
     | 
| 
       133 
     | 
    
         
            -
                end
         
     | 
| 
       134 
     | 
    
         
            -
              end
         
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
102 
     | 
    
         
             
              describe "#save" do
         
     | 
| 
       137 
103 
     | 
    
         
             
                context "when the object is valid" do
         
     | 
| 
       138 
104 
     | 
    
         
             
                  before(:each) { subject.stub(:valid?).and_return(true) }
         
     | 
| 
         @@ -212,62 +178,6 @@ shared_examples_for "a Ridley Resource" do |resource_klass| 
     | 
|
| 
       212 
178 
     | 
    
         
             
                end
         
     | 
| 
       213 
179 
     | 
    
         
             
              end
         
     | 
| 
       214 
180 
     | 
    
         | 
| 
       215 
     | 
    
         
            -
              describe "#from_hash" do
         
     | 
| 
       216 
     | 
    
         
            -
                before(:each) do
         
     | 
| 
       217 
     | 
    
         
            -
                  subject.class.attribute(:name)
         
     | 
| 
       218 
     | 
    
         
            -
                  @object = subject.from_hash(name: "reset")
         
     | 
| 
       219 
     | 
    
         
            -
                end
         
     | 
| 
       220 
     | 
    
         
            -
             
     | 
| 
       221 
     | 
    
         
            -
                it "returns an instance of the implementing class" do
         
     | 
| 
       222 
     | 
    
         
            -
                  @object.should be_a(subject.class)
         
     | 
| 
       223 
     | 
    
         
            -
                end
         
     | 
| 
       224 
     | 
    
         
            -
             
     | 
| 
       225 
     | 
    
         
            -
                it "assigns the attributes to the values of the corresponding keys in the given Hash" do
         
     | 
| 
       226 
     | 
    
         
            -
                  @object.name.should eql("reset")
         
     | 
| 
       227 
     | 
    
         
            -
                end
         
     | 
| 
       228 
     | 
    
         
            -
              end
         
     | 
| 
       229 
     | 
    
         
            -
             
     | 
| 
       230 
     | 
    
         
            -
              describe "#to_hash" do
         
     | 
| 
       231 
     | 
    
         
            -
                it "returns a hash" do
         
     | 
| 
       232 
     | 
    
         
            -
                  subject.to_hash.should be_a(Hash)
         
     | 
| 
       233 
     | 
    
         
            -
                end
         
     | 
| 
       234 
     | 
    
         
            -
             
     | 
| 
       235 
     | 
    
         
            -
                it "delegates to .attributes" do
         
     | 
| 
       236 
     | 
    
         
            -
                  subject.should_receive(:attributes)
         
     | 
| 
       237 
     | 
    
         
            -
             
     | 
| 
       238 
     | 
    
         
            -
                  subject.to_hash
         
     | 
| 
       239 
     | 
    
         
            -
                end
         
     | 
| 
       240 
     | 
    
         
            -
              end
         
     | 
| 
       241 
     | 
    
         
            -
             
     | 
| 
       242 
     | 
    
         
            -
              describe "#to_json" do
         
     | 
| 
       243 
     | 
    
         
            -
                it "serializes the objects attributes using MultiJson" do
         
     | 
| 
       244 
     | 
    
         
            -
                  MultiJson.should_receive(:encode).with(subject.attributes, kind_of(Hash))
         
     | 
| 
       245 
     | 
    
         
            -
             
     | 
| 
       246 
     | 
    
         
            -
                  subject.to_json
         
     | 
| 
       247 
     | 
    
         
            -
                end
         
     | 
| 
       248 
     | 
    
         
            -
             
     | 
| 
       249 
     | 
    
         
            -
                it "returns the seralized value" do
         
     | 
| 
       250 
     | 
    
         
            -
                  MultiJson.stub(:encode).and_return("{}")
         
     | 
| 
       251 
     | 
    
         
            -
             
     | 
| 
       252 
     | 
    
         
            -
                  subject.to_json.should eql("{}")
         
     | 
| 
       253 
     | 
    
         
            -
                end
         
     | 
| 
       254 
     | 
    
         
            -
              end
         
     | 
| 
       255 
     | 
    
         
            -
             
     | 
| 
       256 
     | 
    
         
            -
              describe "#from_json" do
         
     | 
| 
       257 
     | 
    
         
            -
                before(:each) do
         
     | 
| 
       258 
     | 
    
         
            -
                  subject.class.attribute(:name)
         
     | 
| 
       259 
     | 
    
         
            -
                  @object = subject.from_json(%({"name": "reset"}))
         
     | 
| 
       260 
     | 
    
         
            -
                end
         
     | 
| 
       261 
     | 
    
         
            -
             
     | 
| 
       262 
     | 
    
         
            -
                it "returns an instance of the implementing class" do
         
     | 
| 
       263 
     | 
    
         
            -
                  @object.should be_a(subject.class)
         
     | 
| 
       264 
     | 
    
         
            -
                end
         
     | 
| 
       265 
     | 
    
         
            -
             
     | 
| 
       266 
     | 
    
         
            -
                it "assigns the attributes to the values of the corresponding keys in the given JSON" do
         
     | 
| 
       267 
     | 
    
         
            -
                  @object.name.should eql("reset")
         
     | 
| 
       268 
     | 
    
         
            -
                end
         
     | 
| 
       269 
     | 
    
         
            -
              end
         
     | 
| 
       270 
     | 
    
         
            -
             
     | 
| 
       271 
181 
     | 
    
         
             
              describe "#reload" do
         
     | 
| 
       272 
182 
     | 
    
         
             
                let(:updated_subject) { double('updated_subject', attributes: { fake_attribute: "some_value" }) }
         
     | 
| 
       273 
183 
     | 
    
         | 
| 
         @@ -5,95 +5,19 @@ describe Ridley::Resource do 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
              describe "ClassMethods" do
         
     | 
| 
       7 
7 
     | 
    
         
             
                subject do
         
     | 
| 
       8 
     | 
    
         
            -
                  Class.new 
     | 
| 
       9 
     | 
    
         
            -
                    include Ridley::Resource
         
     | 
| 
       10 
     | 
    
         
            -
                  end
         
     | 
| 
      
 8 
     | 
    
         
            +
                  Class.new(Ridley::Resource)
         
     | 
| 
       11 
9 
     | 
    
         
             
                end
         
     | 
| 
       12 
10 
     | 
    
         | 
| 
       13 
11 
     | 
    
         
             
                it_behaves_like "a Ridley Resource", subject.call
         
     | 
| 
       14 
12 
     | 
    
         | 
| 
       15 
13 
     | 
    
         
             
                describe "::initialize" do
         
     | 
| 
       16 
     | 
    
         
            -
                  it " 
     | 
| 
       17 
     | 
    
         
            -
                     
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                     
     | 
| 
       20 
     | 
    
         
            -
                  end
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                  it "assigns the given attributes to the attribute hash if the attribute is defined on the class" do
         
     | 
| 
       23 
     | 
    
         
            -
                    subject.attribute(:name)
         
     | 
| 
       24 
     | 
    
         
            -
                    klass = subject.new(connection, name: "a name")
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                    klass.name.should eql("a name")
         
     | 
| 
       27 
     | 
    
         
            -
                    klass.attributes.should have_key(:name)
         
     | 
| 
       28 
     | 
    
         
            -
                  end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                  it "skips attributes which are not defined on the class when assigning attributes" do
         
     | 
| 
       31 
     | 
    
         
            -
                    klass = subject.new(connection, fake: "not here")
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                    klass.attributes.should_not have_key(:fake)
         
     | 
| 
       34 
     | 
    
         
            -
                  end
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                  it "merges the default values for attributes into the attributes hash" do
         
     | 
| 
       37 
     | 
    
         
            -
                    subject.stub(:attributes).and_return(Set.new([:name]))
         
     | 
| 
       38 
     | 
    
         
            -
                    subject.should_receive(:attribute_defaults).and_return(name: "whatever")
         
     | 
| 
       39 
     | 
    
         
            -
                    klass = subject.new(connection)
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
                    klass.attributes[:name].should eql("whatever")
         
     | 
| 
       42 
     | 
    
         
            -
                  end
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                  it "explicit attributes take precedence over defaults" do
         
     | 
| 
       45 
     | 
    
         
            -
                    subject.stub(:attributes).and_return(Set.new([:name]))
         
     | 
| 
       46 
     | 
    
         
            -
                    subject.stub(:attribute_defaults).and_return(name: "default")
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
                    klass = subject.new(connection, name: "explicit_name")
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
                    klass.attributes[:name].should eql("explicit_name")
         
     | 
| 
       51 
     | 
    
         
            -
                  end
         
     | 
| 
       52 
     | 
    
         
            -
                end
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
                describe "::attributes" do
         
     | 
| 
       55 
     | 
    
         
            -
                  it "returns a Set" do
         
     | 
| 
       56 
     | 
    
         
            -
                    subject.attributes.should be_a(Set)
         
     | 
| 
       57 
     | 
    
         
            -
                  end
         
     | 
| 
       58 
     | 
    
         
            -
                end
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                describe "::attribute" do
         
     | 
| 
       61 
     | 
    
         
            -
                  it "adds the given symbol to the attributes Set" do
         
     | 
| 
       62 
     | 
    
         
            -
                    subject.attribute(:name)
         
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
                    subject.attributes.should include(:name)
         
     | 
| 
       65 
     | 
    
         
            -
                  end
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                  it "convers the given string into a symbol and adds it to the attributes Set" do
         
     | 
| 
       68 
     | 
    
         
            -
                    subject.attribute('last_name')
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                    subject.attributes.should include(:last_name)
         
     | 
| 
       71 
     | 
    
         
            -
                  end
         
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
                  describe "setting a default value for the attribute" do
         
     | 
| 
       74 
     | 
    
         
            -
                    it "allows a string as the default value for the attribute" do
         
     | 
| 
       75 
     | 
    
         
            -
                      subject.attribute(:name, default: "jamie")
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
                      subject.attribute_defaults[:name].should eql("jamie")
         
     | 
| 
       78 
     | 
    
         
            -
                    end
         
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
                    it "allows a false boolean as the default value for the attribute" do
         
     | 
| 
       81 
     | 
    
         
            -
                      subject.attribute(:admin, default: false)
         
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
                      subject.attribute_defaults[:admin].should eql(false)
         
     | 
| 
       84 
     | 
    
         
            -
                    end
         
     | 
| 
      
 14 
     | 
    
         
            +
                  it "mass assigns the given attributes" do
         
     | 
| 
      
 15 
     | 
    
         
            +
                    new_attrs = {
         
     | 
| 
      
 16 
     | 
    
         
            +
                      name: "a name"
         
     | 
| 
      
 17 
     | 
    
         
            +
                    }
         
     | 
| 
       85 
18 
     | 
    
         | 
| 
       86 
     | 
    
         
            -
                     
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
                      subject.attribute_defaults[:admin].should eql(true)
         
     | 
| 
       90 
     | 
    
         
            -
                    end
         
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
                    it "allows nil as the default value for the attribute" do
         
     | 
| 
       93 
     | 
    
         
            -
                      subject.attribute(:certificate, default: nil)
         
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
                      subject.attribute_defaults[:certificate].should be_nil
         
     | 
| 
       96 
     | 
    
         
            -
                    end
         
     | 
| 
      
 19 
     | 
    
         
            +
                    subject.any_instance.should_receive(:mass_assign).with(new_attrs)
         
     | 
| 
      
 20 
     | 
    
         
            +
                    subject.new(connection, new_attrs)
         
     | 
| 
       97 
21 
     | 
    
         
             
                  end
         
     | 
| 
       98 
22 
     | 
    
         
             
                end
         
     | 
| 
       99 
23 
     | 
    
         | 
| 
         @@ -119,13 +43,6 @@ describe Ridley::Resource do 
     | 
|
| 
       119 
43 
     | 
    
         | 
| 
       120 
44 
     | 
    
         
             
                    subject.chef_json_class.should eql("Chef::Environment")
         
     | 
| 
       121 
45 
     | 
    
         
             
                  end
         
     | 
| 
       122 
     | 
    
         
            -
             
     | 
| 
       123 
     | 
    
         
            -
                  it "sets the value of the :json_class attribute default to the given value" do
         
     | 
| 
       124 
     | 
    
         
            -
                    subject.set_chef_json_class("Chef::Environment")
         
     | 
| 
       125 
     | 
    
         
            -
             
     | 
| 
       126 
     | 
    
         
            -
                    subject.attribute_defaults.should have_key(:json_class)
         
     | 
| 
       127 
     | 
    
         
            -
                    subject.attribute_defaults[:json_class].should eql("Chef::Environment")
         
     | 
| 
       128 
     | 
    
         
            -
                  end
         
     | 
| 
       129 
46 
     | 
    
         
             
                end
         
     | 
| 
       130 
47 
     | 
    
         | 
| 
       131 
48 
     | 
    
         
             
                describe "::set_chef_id" do
         
     | 
| 
         @@ -162,50 +79,17 @@ describe Ridley::Resource do 
     | 
|
| 
       162 
79 
     | 
    
         
             
              end
         
     | 
| 
       163 
80 
     | 
    
         | 
| 
       164 
81 
     | 
    
         
             
              subject do
         
     | 
| 
       165 
     | 
    
         
            -
                Class.new 
     | 
| 
       166 
     | 
    
         
            -
                  include Ridley::Resource
         
     | 
| 
       167 
     | 
    
         
            -
                end.new(connection)
         
     | 
| 
      
 82 
     | 
    
         
            +
                Class.new(Ridley::Resource).new(connection)
         
     | 
| 
       168 
83 
     | 
    
         
             
              end
         
     | 
| 
       169 
84 
     | 
    
         | 
| 
       170 
     | 
    
         
            -
              describe "# 
     | 
| 
       171 
     | 
    
         
            -
                 
     | 
| 
       172 
     | 
    
         
            -
                   
     | 
| 
       173 
     | 
    
         
            -
                     
     | 
| 
       174 
     | 
    
         
            -
                  end
         
     | 
| 
       175 
     | 
    
         
            -
             
     | 
| 
       176 
     | 
    
         
            -
                  it "returns false if the attribute has no value" do
         
     | 
| 
       177 
     | 
    
         
            -
                    subject.name = nil
         
     | 
| 
       178 
     | 
    
         
            -
             
     | 
| 
       179 
     | 
    
         
            -
                    subject.attribute?(:name).should be_false
         
     | 
| 
       180 
     | 
    
         
            -
                  end
         
     | 
| 
       181 
     | 
    
         
            -
             
     | 
| 
       182 
     | 
    
         
            -
                  it "returns true if the attribute has a value" do
         
     | 
| 
       183 
     | 
    
         
            -
                    subject.name = "reset"
         
     | 
| 
       184 
     | 
    
         
            -
             
     | 
| 
       185 
     | 
    
         
            -
                    subject.attribute?(:name).should be_true
         
     | 
| 
       186 
     | 
    
         
            -
                  end
         
     | 
| 
       187 
     | 
    
         
            -
                end
         
     | 
| 
       188 
     | 
    
         
            -
             
     | 
| 
       189 
     | 
    
         
            -
                context "if the class has the attribute defined with a default value" do
         
     | 
| 
       190 
     | 
    
         
            -
                  before(:each) do
         
     | 
| 
       191 
     | 
    
         
            -
                    subject.class.attribute(:name, default: "exception")
         
     | 
| 
       192 
     | 
    
         
            -
                  end
         
     | 
| 
       193 
     | 
    
         
            -
             
     | 
| 
       194 
     | 
    
         
            -
                  it "returns true if the attribute has not been explicitly set" do
         
     | 
| 
       195 
     | 
    
         
            -
                    subject.attribute?(:name).should be_true
         
     | 
| 
       196 
     | 
    
         
            -
                  end
         
     | 
| 
       197 
     | 
    
         
            -
                end
         
     | 
| 
       198 
     | 
    
         
            -
             
     | 
| 
       199 
     | 
    
         
            -
                context "if the class does not have the attribute defined" do
         
     | 
| 
       200 
     | 
    
         
            -
                  it "returns false" do
         
     | 
| 
       201 
     | 
    
         
            -
                    subject.attribute?(:name).should be_false
         
     | 
| 
       202 
     | 
    
         
            -
                  end
         
     | 
| 
      
 85 
     | 
    
         
            +
              describe "#attributes=" do
         
     | 
| 
      
 86 
     | 
    
         
            +
                subject do
         
     | 
| 
      
 87 
     | 
    
         
            +
                  Class.new(Ridley::Resource) do
         
     | 
| 
      
 88 
     | 
    
         
            +
                    attribute :name
         
     | 
| 
      
 89 
     | 
    
         
            +
                  end.new(connection)
         
     | 
| 
       203 
90 
     | 
    
         
             
                end
         
     | 
| 
       204 
     | 
    
         
            -
              end
         
     | 
| 
       205 
91 
     | 
    
         | 
| 
       206 
     | 
    
         
            -
              describe "#attributes=" do
         
     | 
| 
       207 
92 
     | 
    
         
             
                it "assigns the hash of attributes to the objects attributes" do
         
     | 
| 
       208 
     | 
    
         
            -
                  subject.class.attribute(:name)
         
     | 
| 
       209 
93 
     | 
    
         
             
                  subject.attributes = { name: "reset" }
         
     | 
| 
       210 
94 
     | 
    
         | 
| 
       211 
95 
     | 
    
         
             
                  subject.attributes[:name].should eql("reset")
         
     | 
| 
         @@ -214,9 +98,7 @@ describe Ridley::Resource do 
     | 
|
| 
       214 
98 
     | 
    
         | 
| 
       215 
99 
     | 
    
         
             
              describe "comparable" do
         
     | 
| 
       216 
100 
     | 
    
         
             
                subject do
         
     | 
| 
       217 
     | 
    
         
            -
                  Class.new do
         
     | 
| 
       218 
     | 
    
         
            -
                    include Ridley::Resource
         
     | 
| 
       219 
     | 
    
         
            -
             
     | 
| 
      
 101 
     | 
    
         
            +
                  Class.new(Ridley::Resource) do
         
     | 
| 
       220 
102 
     | 
    
         
             
                    set_chef_id "name"
         
     | 
| 
       221 
103 
     | 
    
         | 
| 
       222 
104 
     | 
    
         
             
                    attribute "name"
         
     | 
| 
         @@ -253,9 +135,7 @@ describe Ridley::Resource do 
     | 
|
| 
       253 
135 
     | 
    
         | 
| 
       254 
136 
     | 
    
         
             
              describe "uniqueness" do
         
     | 
| 
       255 
137 
     | 
    
         
             
                subject do
         
     | 
| 
       256 
     | 
    
         
            -
                  Class.new do
         
     | 
| 
       257 
     | 
    
         
            -
                    include Ridley::Resource
         
     | 
| 
       258 
     | 
    
         
            -
             
     | 
| 
      
 138 
     | 
    
         
            +
                  Class.new(Ridley::Resource) do
         
     | 
| 
       259 
139 
     | 
    
         
             
                    set_chef_id "name"
         
     | 
| 
       260 
140 
     | 
    
         | 
| 
       261 
141 
     | 
    
         
             
                    attribute "name"
         
     | 
| 
         @@ -75,35 +75,7 @@ describe Ridley::Environment do 
     | 
|
| 
       75 
75 
     | 
    
         | 
| 
       76 
76 
     | 
    
         
             
              subject { Ridley::Environment.new(connection) }
         
     | 
| 
       77 
77 
     | 
    
         | 
| 
       78 
     | 
    
         
            -
              describe "#default_attributes=" do
         
     | 
| 
       79 
     | 
    
         
            -
                context "given a Hash" do
         
     | 
| 
       80 
     | 
    
         
            -
                  it "returns a HashWithIndifferentAccess" do
         
     | 
| 
       81 
     | 
    
         
            -
                    subject.default_attributes = {
         
     | 
| 
       82 
     | 
    
         
            -
                      "key" => "value"
         
     | 
| 
       83 
     | 
    
         
            -
                    }
         
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
                    subject.default_attributes.should be_a(HashWithIndifferentAccess)
         
     | 
| 
       86 
     | 
    
         
            -
                  end
         
     | 
| 
       87 
     | 
    
         
            -
                end
         
     | 
| 
       88 
     | 
    
         
            -
              end
         
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
              describe "#override_attributes=" do
         
     | 
| 
       91 
     | 
    
         
            -
                context "given a Hash" do
         
     | 
| 
       92 
     | 
    
         
            -
                  it "returns a HashWithIndifferentAccess" do
         
     | 
| 
       93 
     | 
    
         
            -
                    subject.override_attributes = {
         
     | 
| 
       94 
     | 
    
         
            -
                      "key" => "value"
         
     | 
| 
       95 
     | 
    
         
            -
                    }
         
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
                    subject.override_attributes.should be_a(HashWithIndifferentAccess)
         
     | 
| 
       98 
     | 
    
         
            -
                  end
         
     | 
| 
       99 
     | 
    
         
            -
                end
         
     | 
| 
       100 
     | 
    
         
            -
              end
         
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
78 
     | 
    
         
             
              describe "#set_override_attribute" do
         
     | 
| 
       103 
     | 
    
         
            -
                it "returns a HashWithIndifferentAccess" do
         
     | 
| 
       104 
     | 
    
         
            -
                  subject.set_override_attribute('deep.nested.item', true).should be_a(HashWithIndifferentAccess)
         
     | 
| 
       105 
     | 
    
         
            -
                end
         
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
79 
     | 
    
         
             
                it "sets an override node attribute at the nested path" do
         
     | 
| 
       108 
80 
     | 
    
         
             
                   subject.set_override_attribute('deep.nested.item', true)
         
     | 
| 
       109 
81 
     | 
    
         | 
| 
         @@ -130,10 +102,6 @@ describe Ridley::Environment do 
     | 
|
| 
       130 
102 
     | 
    
         
             
              end
         
     | 
| 
       131 
103 
     | 
    
         | 
| 
       132 
104 
     | 
    
         
             
              describe "#set_default_attribute" do
         
     | 
| 
       133 
     | 
    
         
            -
                it "returns a HashWithIndifferentAccess" do
         
     | 
| 
       134 
     | 
    
         
            -
                  subject.set_default_attribute('deep.nested.item', true).should be_a(HashWithIndifferentAccess)
         
     | 
| 
       135 
     | 
    
         
            -
                end
         
     | 
| 
       136 
     | 
    
         
            -
             
     | 
| 
       137 
105 
     | 
    
         
             
                it "sets an override node attribute at the nested path" do
         
     | 
| 
       138 
106 
     | 
    
         
             
                   subject.set_default_attribute('deep.nested.item', true)
         
     | 
| 
       139 
107 
     | 
    
         | 
| 
         @@ -50,61 +50,9 @@ describe Ridley::Node do 
     | 
|
| 
       50 
50 
     | 
    
         | 
| 
       51 
51 
     | 
    
         
             
              subject { Ridley::Node.new(connection) }
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
       53 
     | 
    
         
            -
              describe "# 
     | 
| 
       54 
     | 
    
         
            -
                context "given a Hash" do
         
     | 
| 
       55 
     | 
    
         
            -
                  it "returns a HashWithIndifferentAccess" do
         
     | 
| 
       56 
     | 
    
         
            -
                    subject.override = {
         
     | 
| 
       57 
     | 
    
         
            -
                      "key" => "value"
         
     | 
| 
       58 
     | 
    
         
            -
                    }
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                    subject.override.should be_a(HashWithIndifferentAccess)
         
     | 
| 
       61 
     | 
    
         
            -
                  end
         
     | 
| 
       62 
     | 
    
         
            -
                end
         
     | 
| 
       63 
     | 
    
         
            -
              end
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
              describe "#automatic=" do
         
     | 
| 
       66 
     | 
    
         
            -
                context "given a Hash" do
         
     | 
| 
       67 
     | 
    
         
            -
                  it "returns a HashWithIndifferentAccess" do
         
     | 
| 
       68 
     | 
    
         
            -
                    subject.automatic = {
         
     | 
| 
       69 
     | 
    
         
            -
                      "key" => "value"
         
     | 
| 
       70 
     | 
    
         
            -
                    }
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
                    subject.automatic.should be_a(HashWithIndifferentAccess)
         
     | 
| 
       73 
     | 
    
         
            -
                  end
         
     | 
| 
       74 
     | 
    
         
            -
                end
         
     | 
| 
       75 
     | 
    
         
            -
              end
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
              describe "#normal=" do
         
     | 
| 
       78 
     | 
    
         
            -
                context "given a Hash" do
         
     | 
| 
       79 
     | 
    
         
            -
                  it "returns a HashWithIndifferentAccess" do
         
     | 
| 
       80 
     | 
    
         
            -
                    subject.normal = {
         
     | 
| 
       81 
     | 
    
         
            -
                      "key" => "value"
         
     | 
| 
       82 
     | 
    
         
            -
                    }
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
                    subject.normal.should be_a(HashWithIndifferentAccess)
         
     | 
| 
       85 
     | 
    
         
            -
                  end
         
     | 
| 
       86 
     | 
    
         
            -
                end
         
     | 
| 
       87 
     | 
    
         
            -
              end
         
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
              describe "#default=" do
         
     | 
| 
       90 
     | 
    
         
            -
                context "given a Hash" do
         
     | 
| 
       91 
     | 
    
         
            -
                  it "returns a HashWithIndifferentAccess" do
         
     | 
| 
       92 
     | 
    
         
            -
                    subject.default = {
         
     | 
| 
       93 
     | 
    
         
            -
                      "key" => "value"
         
     | 
| 
       94 
     | 
    
         
            -
                    }
         
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
                    subject.default.should be_a(HashWithIndifferentAccess)
         
     | 
| 
       97 
     | 
    
         
            -
                  end
         
     | 
| 
       98 
     | 
    
         
            -
                end
         
     | 
| 
       99 
     | 
    
         
            -
              end
         
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
              describe "#set_attribute" do
         
     | 
| 
       102 
     | 
    
         
            -
                it "returns a HashWithIndifferentAccess" do
         
     | 
| 
       103 
     | 
    
         
            -
                  subject.set_attribute('deep.nested.item', true).should be_a(HashWithIndifferentAccess)
         
     | 
| 
       104 
     | 
    
         
            -
                end
         
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
      
 53 
     | 
    
         
            +
              describe "#set_chef_attribute" do
         
     | 
| 
       106 
54 
     | 
    
         
             
                it "sets an normal node attribute at the nested path" do
         
     | 
| 
       107 
     | 
    
         
            -
                   subject. 
     | 
| 
      
 55 
     | 
    
         
            +
                   subject.set_chef_attribute('deep.nested.item', true)
         
     | 
| 
       108 
56 
     | 
    
         | 
| 
       109 
57 
     | 
    
         
             
                   subject.normal.should have_key("deep")
         
     | 
| 
       110 
58 
     | 
    
         
             
                   subject.normal["deep"].should have_key("nested")
         
     | 
| 
         @@ -121,7 +69,7 @@ describe Ridley::Node do 
     | 
|
| 
       121 
69 
     | 
    
         
             
                        }
         
     | 
| 
       122 
70 
     | 
    
         
             
                      }
         
     | 
| 
       123 
71 
     | 
    
         
             
                    }
         
     | 
| 
       124 
     | 
    
         
            -
                    subject. 
     | 
| 
      
 72 
     | 
    
         
            +
                    subject.set_chef_attribute('deep.nested.item', true)
         
     | 
| 
       125 
73 
     | 
    
         | 
| 
       126 
74 
     | 
    
         
             
                    subject.normal["deep"]["nested"]["item"].should be_true
         
     | 
| 
       127 
75 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -7,35 +7,7 @@ describe Ridley::Role do 
     | 
|
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
              subject { Ridley::Role.new(connection) }
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
              describe "#override_attributes=" do
         
     | 
| 
       11 
     | 
    
         
            -
                context "given a Hash" do
         
     | 
| 
       12 
     | 
    
         
            -
                  it "returns a HashWithIndifferentAccess" do
         
     | 
| 
       13 
     | 
    
         
            -
                    subject.override_attributes = {
         
     | 
| 
       14 
     | 
    
         
            -
                      "key" => "value"
         
     | 
| 
       15 
     | 
    
         
            -
                    }
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                    subject.override_attributes.should be_a(HashWithIndifferentAccess)
         
     | 
| 
       18 
     | 
    
         
            -
                  end
         
     | 
| 
       19 
     | 
    
         
            -
                end
         
     | 
| 
       20 
     | 
    
         
            -
              end
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
              describe "#default_attributes=" do
         
     | 
| 
       23 
     | 
    
         
            -
                context "given a Hash" do
         
     | 
| 
       24 
     | 
    
         
            -
                  it "returns a HashWithIndifferentAccess" do
         
     | 
| 
       25 
     | 
    
         
            -
                    subject.default_attributes = {
         
     | 
| 
       26 
     | 
    
         
            -
                      "key" => "value"
         
     | 
| 
       27 
     | 
    
         
            -
                    }
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
                    subject.default_attributes.should be_a(HashWithIndifferentAccess)
         
     | 
| 
       30 
     | 
    
         
            -
                  end
         
     | 
| 
       31 
     | 
    
         
            -
                end
         
     | 
| 
       32 
     | 
    
         
            -
              end
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
10 
     | 
    
         
             
              describe "#set_override_attribute" do
         
     | 
| 
       35 
     | 
    
         
            -
                it "returns a HashWithIndifferentAccess" do
         
     | 
| 
       36 
     | 
    
         
            -
                  subject.set_override_attribute('deep.nested.item', true).should be_a(HashWithIndifferentAccess)
         
     | 
| 
       37 
     | 
    
         
            -
                end
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
11 
     | 
    
         
             
                it "sets an override node attribute at the nested path" do
         
     | 
| 
       40 
12 
     | 
    
         
             
                   subject.set_override_attribute('deep.nested.item', true)
         
     | 
| 
       41 
13 
     | 
    
         | 
| 
         @@ -62,10 +34,6 @@ describe Ridley::Role do 
     | 
|
| 
       62 
34 
     | 
    
         
             
              end
         
     | 
| 
       63 
35 
     | 
    
         | 
| 
       64 
36 
     | 
    
         
             
              describe "#set_default_attribute" do
         
     | 
| 
       65 
     | 
    
         
            -
                it "returns a HashWithIndifferentAccess" do
         
     | 
| 
       66 
     | 
    
         
            -
                  subject.set_default_attribute('deep.nested.item', true).should be_a(HashWithIndifferentAccess)
         
     | 
| 
       67 
     | 
    
         
            -
                end
         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
37 
     | 
    
         
             
                it "sets an override node attribute at the nested path" do
         
     | 
| 
       70 
38 
     | 
    
         
             
                   subject.set_default_attribute('deep.nested.item', true)
         
     | 
| 
       71 
39 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: ridley
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
       5 
     | 
    
         
            -
              prerelease: 
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.7.0.beta
         
     | 
| 
      
 5 
     | 
    
         
            +
              prerelease: 6
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
       8 
8 
     | 
    
         
             
            - Jamie Winsor
         
     | 
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2013-01- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2013-01-11 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: json
         
     | 
| 
         @@ -50,7 +50,7 @@ dependencies: 
     | 
|
| 
       50 
50 
     | 
    
         
             
                requirements:
         
     | 
| 
       51 
51 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
       52 
52 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       53 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 53 
     | 
    
         
            +
                    version: 0.4.1
         
     | 
| 
       54 
54 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       55 
55 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       56 
56 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -58,7 +58,7 @@ dependencies: 
     | 
|
| 
       58 
58 
     | 
    
         
             
                requirements:
         
     | 
| 
       59 
59 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
       60 
60 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       61 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 61 
     | 
    
         
            +
                    version: 0.4.1
         
     | 
| 
       62 
62 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       63 
63 
     | 
    
         
             
              name: mixlib-log
         
     | 
| 
       64 
64 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -123,22 +123,6 @@ dependencies: 
     | 
|
| 
       123 
123 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
       124 
124 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       125 
125 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       126 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       127 
     | 
    
         
            -
              name: activemodel
         
     | 
| 
       128 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       129 
     | 
    
         
            -
                none: false
         
     | 
| 
       130 
     | 
    
         
            -
                requirements:
         
     | 
| 
       131 
     | 
    
         
            -
                - - ! '>='
         
     | 
| 
       132 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       133 
     | 
    
         
            -
                    version: 3.2.0
         
     | 
| 
       134 
     | 
    
         
            -
              type: :runtime
         
     | 
| 
       135 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       136 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       137 
     | 
    
         
            -
                none: false
         
     | 
| 
       138 
     | 
    
         
            -
                requirements:
         
     | 
| 
       139 
     | 
    
         
            -
                - - ! '>='
         
     | 
| 
       140 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       141 
     | 
    
         
            -
                    version: 3.2.0
         
     | 
| 
       142 
126 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       143 
127 
     | 
    
         
             
              name: activesupport
         
     | 
| 
       144 
128 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -320,12 +304,9 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       320 
304 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       321 
305 
     | 
    
         
             
              none: false
         
     | 
| 
       322 
306 
     | 
    
         
             
              requirements:
         
     | 
| 
       323 
     | 
    
         
            -
              - - ! ' 
     | 
| 
      
 307 
     | 
    
         
            +
              - - ! '>'
         
     | 
| 
       324 
308 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       325 
     | 
    
         
            -
                  version:  
     | 
| 
       326 
     | 
    
         
            -
                  segments:
         
     | 
| 
       327 
     | 
    
         
            -
                  - 0
         
     | 
| 
       328 
     | 
    
         
            -
                  hash: -3636346058198245509
         
     | 
| 
      
 309 
     | 
    
         
            +
                  version: 1.3.1
         
     | 
| 
       329 
310 
     | 
    
         
             
            requirements: []
         
     | 
| 
       330 
311 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       331 
312 
     | 
    
         
             
            rubygems_version: 1.8.23
         
     |