community-cookbooks/windows/libraries/windows_helper.rb
# if a file is local it returns a windows friendly path version
# if a file is remote it caches it locally
if a file is local it returns a windows friendly path version
if a file is remote it caches it locally
if a file is local it returns a windows friendly path version if a file is remote it caches it locally
def cached_file(source, checksum = nil, windows_path = true)
      @installer_file_path ||= begin
        if source =~ %r{^(file|ftp|http|https):\/\/}
          uri = as_uri(source)
          cache_file_path = "#{Chef::Config[:file_cache_path]}/#{::File.basename(::URI.unescape(uri.path))}"
          Chef::Log.debug("Caching a copy of file #{source} at #{cache_file_path}")
          remote_file cache_file_path do
            source source
            backup false
            checksum checksum unless checksum.nil?
          end.run_action(:create)
        else
          cache_file_path = source
        end
        windows_path ? win_friendly_path(cache_file_path) : cache_file_path
      end
    end
def cached_file ( source , checksum = nil , windows_path = true ) @installer_file_path ||= begin if source =~ %r{ ^(file|ftp|http|https): \/ \/ } uri = as_uri ( source ) cache_file_path = "#{Chef::Config[:file_cache_path]}/#{::File.basename(::URI.unescape(uri.path))}" Chef :: Log . debug ( "Caching a copy of file #{source} at #{cache_file_path}" ) remote_file cache_file_path do source source backup false checksum checksum unless checksum . nil? end . run_action ( :create ) else cache_file_path = source end windows_path ? win_friendly_path ( cache_file_path ) : cache_file_path end end
if a file is local it returns a windows friendly path version
if a file is remote it caches it locally
if a file is local it returns a windows friendly path version if a file is remote it caches it locally
source
<not_specific>
checksum
<not_specific>
windows_path
<not_specific>