Sha256: ce7c4dd88bb559a3cd3abad19897160f44296c1fc96e88abd8e8dc2ff543172c
Contents?: true
Size: 904 Bytes
Versions: 2
Compression:
Stored size: 904 Bytes
Contents
require 'chef_fs/file_system/base_fs_dir' require 'chef_fs/file_system/rest_list_dir' require 'chef_fs/path_utils' module ChefFS module FileSystem class FileSystemEntry < BaseFSDir def initialize(name, parent, file_path = nil) super(name, parent) @file_path = file_path || "#{parent.file_path}/#{name}" end attr_reader :file_path def path_for_printing ChefFS::PathUtils::relative_to(file_path, File.absolute_path(Dir.pwd)) end def children @children ||= Dir.entries(file_path).select { |entry| entry[0] != "." }.map { |entry| FileSystemEntry.new(entry, self) } end def dir? File.directory?(file_path) end def read begin IO.read(file_path) rescue IONotFoundException # TODO real exception raise NotFoundException, $! end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
knife-essentials-0.1.1 | lib/chef_fs/file_system/file_system_entry.rb |
knife-essentials-0.1 | lib/chef_fs/file_system/file_system_entry.rb |