def has_source?(source, segment, cookbook=nil)
      cookbook ||= cookbook_name
      begin
        run_context.cookbook_collection[cookbook].
          send(:find_preferred_manifest_record, run_context.node, segment, source)
      rescue Chef::Exceptions::FileNotFound
        nil
      end
    end
def has_source?(source, segment, cookbook=nil)
      cookbook ||= cookbook_name
      begin
        run_context.cookbook_collection[cookbook].
          send(:find_preferred_manifest_record, run_context.node, segment, source)
      rescue Chef::Exceptions::FileNotFound
        nil
      end
    end
Checks for existence of a cookbook file or template source in a cookbook.
 @param [String] source name of the desired template or cookbook file source
 @param [Symbol] segment `:files` or `:templates`
 @param [String, nil] cookbook to look in, defaults to current cookbook
 @return [String, nil] full path to the source or `nil` if it doesn't exist
 @example
   has_source?("foo.erb", :templates)
   has_source?("bar.conf", :files, "a_cookbook")