summaryrefslogtreecommitdiff
path: root/lib/chef/resource_collection.rb
diff options
context:
space:
mode:
authortyler-ball <tyleraball@gmail.com>2014-10-16 17:17:08 -0500
committertyler-ball <tyleraball@gmail.com>2014-10-16 17:17:08 -0500
commitb4adfb4cee189f2d3fdc534a24077269616cdd28 (patch)
treee52f3e97a69858401c3ab58002e3c9cca3d1f497 /lib/chef/resource_collection.rb
parent2cae7f7b39fd5dc34eefd5e0700bdbd693c6cba5 (diff)
downloadchef-b4adfb4cee189f2d3fdc534a24077269616cdd28.tar.gz
Added some documentation and cleaned up unecessary TODOs. Added first round of specs for the new classes.
Diffstat (limited to 'lib/chef/resource_collection.rb')
-rw-r--r--lib/chef/resource_collection.rb17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/chef/resource_collection.rb b/lib/chef/resource_collection.rb
index 60e322af44..2e202bd6eb 100644
--- a/lib/chef/resource_collection.rb
+++ b/lib/chef/resource_collection.rb
@@ -20,6 +20,7 @@
require 'chef/resource_collection/resource_set'
require 'chef/resource_collection/resource_list'
require 'chef/resource_collection/resource_collection_serialization'
+require 'chef/log'
##
# ResourceCollection currently handles two tasks:
@@ -56,36 +57,34 @@ class Chef
# @param insert_at_index [Integer] Location to insert resources
# @param resources [Chef::Resource] Resources to insert
- # @depreciated Callers should use the insert method above and loop through their resources as necessary
+ # @deprecated Callers should use the insert method above and loop through their resources as necessary
def insert_at(insert_at_index, *resources)
+ Chef::Log.warn("`insert_at` is deprecated, use `insert` with the `at_location` parameter")
@resource_list.insert_at(insert_at_index, *resources)
resources.each do |resource|
@resource_set.insert_as(resource)
end
end
- # @depreciated
+ # @deprecated
def []=(index, resource)
+ Chef::Log.warn("`[]=` is deprecated, use `insert` with the `at_location` parameter")
@resource_list[index] = resource
@resource_set.insert_as(resource)
end
- # @depreciated
+ # @deprecated
def <<(*resources)
+ Chef::Log.warn("`<<` is deprecated, use `insert`")
resources.flatten.each do |res|
insert(res)
end
self
end
- # @depreciated
+ # @deprecated
alias_method :push, :<<
- # TODO when there were 2 resources with the same key in resource_set, how do we handle notifications since they get copied?
- # Did the old class only keep the last seen reference?
-
- # TODO do we need to implement a dup method? Run_context was shallowly copying resource_collection before
-
# Read-only methods are simple to proxy - doing that below
RESOURCE_LIST_METHODS = Enumerable.instance_methods +