diff options
author | Tim Smith <tsmith@chef.io> | 2017-12-14 20:01:55 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-14 20:01:55 -0800 |
commit | 61a308ece615ecd2d45062a3d314474f50565e66 (patch) | |
tree | 9e231c3e489651011c8549ffa48e29e757b41aa0 /lib/chef/resource | |
parent | 8c4a29b8055eaa4326c1e6b25118bbcd053cbe8c (diff) | |
parent | be8540a076226051029dc161895bc887eb4813b1 (diff) | |
download | chef-61a308ece615ecd2d45062a3d314474f50565e66.tar.gz |
Merge pull request #6665 from chef/yard2
Add a few more YARD comments to resources
Diffstat (limited to 'lib/chef/resource')
-rw-r--r-- | lib/chef/resource/chef_gem.rb | 1 | ||||
-rw-r--r-- | lib/chef/resource/file.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/freebsd_package.rb | 11 | ||||
-rw-r--r-- | lib/chef/resource/resource_notification.rb | 17 |
4 files changed, 28 insertions, 3 deletions
diff --git a/lib/chef/resource/chef_gem.rb b/lib/chef/resource/chef_gem.rb index 7025d74e58..3a2d90e852 100644 --- a/lib/chef/resource/chef_gem.rb +++ b/lib/chef/resource/chef_gem.rb @@ -30,6 +30,7 @@ class Chef } property :compile_time, [ true, false ], default: false, desired_state: false + # force the resource to compile time if the compile time property has been set def after_created if compile_time Array(action).each do |action| diff --git a/lib/chef/resource/file.rb b/lib/chef/resource/file.rb index 5c275a574f..0540385646 100644 --- a/lib/chef/resource/file.rb +++ b/lib/chef/resource/file.rb @@ -43,7 +43,7 @@ class Chef # mutate the new_resource.checksum which would change the # user intent in the new_resource if the resource is reused. # - # @returns [String] Checksum of the file we actually rendered + # @return [String] Checksum of the file we actually rendered attr_accessor :final_checksum default_action :create diff --git a/lib/chef/resource/freebsd_package.rb b/lib/chef/resource/freebsd_package.rb index ecaff95244..eedddf28e7 100644 --- a/lib/chef/resource/freebsd_package.rb +++ b/lib/chef/resource/freebsd_package.rb @@ -32,19 +32,26 @@ class Chef resource_name :freebsd_package provides :package, platform: "freebsd" + # make sure we assign the appropriate underlying providers based on what + # package managers exist on this FreeBSD system or the source of the package + # + # @return [void] def after_created assign_provider end + # Is the system at least version 1000017 or is the make variable WITH_PKGNG set + # + # @return [Boolean] do we support pkgng def supports_pkgng? ships_with_pkgng? || !!shell_out_compact!("make", "-V", "WITH_PKGNG", :env => nil).stdout.match(/yes/i) end private + # It was not until __FreeBSD_version 1000017 that pkgng became + # the default binary package manager. See '/usr/ports/Mk/bsd.port.mk'. def ships_with_pkgng? - # It was not until __FreeBSD_version 1000017 that pkgng became - # the default binary package manager. See '/usr/ports/Mk/bsd.port.mk'. node[:os_version].to_i >= 1000017 end diff --git a/lib/chef/resource/resource_notification.rb b/lib/chef/resource/resource_notification.rb index ee90064a17..bd09097669 100644 --- a/lib/chef/resource/resource_notification.rb +++ b/lib/chef/resource/resource_notification.rb @@ -20,6 +20,10 @@ require "chef/resource" class Chef class Resource + # @author Tyler Ball + # @attr [Resource] resource the Chef resource object to notify to + # @attr [Action] action the action to notify + # @attr [Resource] notifying_resource the Chef resource performing the notification class Notification attr_accessor :resource, :action, :notifying_resource @@ -30,6 +34,10 @@ class Chef @notifying_resource = notifying_resource end + # Is the current notification a duplicate of another notification + # + # @param [Notification] another notification object to compare to + # @return [Boolean] does the resource match def duplicates?(other_notification) unless other_notification.respond_to?(:resource) && other_notification.respond_to?(:action) msg = "only duck-types of Chef::Resource::Notification can be checked for duplication "\ @@ -41,6 +49,9 @@ class Chef # If resource and/or notifying_resource is not a resource object, this will look them up in the resource collection # and fix the references from strings to actual Resource objects. + # @param [ResourceCollection] resource_collection + # + # @return [void] def resolve_resource_reference(resource_collection) return resource if resource.kind_of?(Chef::Resource) && notifying_resource.kind_of?(Chef::Resource) @@ -55,6 +66,9 @@ class Chef # This will look up the resource if it is not a Resource Object. It will complain if it finds multiple # resources, can't find a resource, or gets invalid syntax. + # @param [ResourceCollection] resource_collection + # + # @return [void] def fix_resource_reference(resource_collection) matching_resource = resource_collection.find(resource) if Array(matching_resource).size > 1 @@ -84,6 +98,9 @@ is defined near #{notifying_resource.source_line} # This will look up the notifying_resource if it is not a Resource Object. It will complain if it finds multiple # resources, can't find a resource, or gets invalid syntax. + # @param [ResourceCollection] resource_collection + # + # @return [void] def fix_notifier_reference(resource_collection) matching_notifier = resource_collection.find(notifying_resource) if Array(matching_notifier).size > 1 |