def cookbook_file_resource(target_path, relative_source_path)
cookbook_file = Chef::Resource::CookbookFile.new(target_path, run_context)
cookbook_file.cookbook_name = @new_resource.cookbook || @new_resource.cookbook_name
cookbook_file.source(::File.join(@new_resource.source, relative_source_path))
if Chef::Platform.windows? && @new_resource.files_rights
@new_resource.files_rights.each_pair do |permission, *args|
cookbook_file.rights(permission, *args)
end
end
cookbook_file.mode(@new_resource.files_mode) if @new_resource.files_mode
cookbook_file.group(@new_resource.files_group) if @new_resource.files_group
cookbook_file.owner(@new_resource.files_owner) if @new_resource.files_owner
cookbook_file.backup(@new_resource.files_backup) if @new_resource.files_backup
cookbook_file
end