Module: Chef::Deprecation::Provider::RemoteDirectory

Included in:
Provider::RemoteDirectory
Defined in:
lib/chef/deprecation/provider/remote_directory.rb

Instance Method Summary collapse

Instance Method Details

#directory_root_in_cookbook_cacheObject



24
25
26
27
28
29
30
31
32
# File 'lib/chef/deprecation/provider/remote_directory.rb', line 24

def directory_root_in_cookbook_cache
  Chef.log_deprecation "the Chef::Provider::RemoteDirectory#directory_root_in_cookbook_cache method is deprecated"

  @directory_root_in_cookbook_cache ||=
    begin
      cookbook = run_context.cookbook_collection[resource_cookbook]
      cookbook.preferred_filename_on_disk_location(node, :files, source, path)
    end
end

#ls(path) ⇒ Object

List all excluding . and ..



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/chef/deprecation/provider/remote_directory.rb', line 35

def ls(path)
  files = Dir.glob(::File.join(Chef::Util::PathHelper.escape_glob_dir(path), "**", "*"),
                   ::File::FNM_DOTMATCH)

  # Remove current directory and previous directory
  files = files.reject do |name|
    basename = Pathname.new(name).basename().to_s
    [".", ".."].include?(basename)
  end

  # Clean all the paths... this is required because of the join
  files.map { |f| Chef::Util::PathHelper.cleanpath(f) }
end