class Chef::Provider::RemoteFile::LocalFile
Attributes
Public Class Methods
Source
# File lib/chef/provider/remote_file/local_file.rb, line 32 def initialize(uri, new_resource, current_resource) @new_resource = new_resource @uri = uri end
Public Instance Methods
Source
# File lib/chef/provider/remote_file/local_file.rb, line 50 def fetch tempfile = Chef::FileContentManagement::Tempfile.new(new_resource).tempfile Chef::Log.trace("#{new_resource} staging #{source_path} to #{tempfile.path}") FileUtils.cp(source_path, tempfile.path) tempfile.close if tempfile tempfile end
Fetches the file at uri, returning a Tempfile-like File
handle
Source
# File lib/chef/provider/remote_file/local_file.rb, line 38 def fix_windows_path(path) path.gsub(%r{^/([a-zA-Z]:)}, '\1') end
CHEF-4472: Remove the leading slash from windows paths that we receive from a file:// URI
Source
# File lib/chef/provider/remote_file/local_file.rb, line 42 def source_path @source_path ||= begin path = CGI.unescape(uri.path) ChefUtils.windows? ? fix_windows_path(path) : path end end