class EacRubyUtils::Templates::Directory
def apply(variables_source, directory)
def apply(variables_source, directory) TemplateNode.new(self, '.', directory, variables_source).apply end
def apply_fs_object(source_relative, target)
def apply_fs_object(source_relative, target) if ::File.directory?(source_absolute(source_relative)) apply_directory(source_relative, target) elsif ::File.file?(source_absolute(source_relative)) end end
def child(subpath)
def child(subpath) child_path = ::File.join(path, subpath) return ::EacRubyUtils::Templates::File.new(child_path) if ::File.file?(child_path) return ::EacRubyUtils::Templates::Directory.new(child_path) if ::File.directory?(child_path) raise "Child \"#{subpath}\" from \"#{path}\" not found" end
def children
def children path.children.map do |path_child| child(path_child.basename.to_path) end end
def initialize(path)
def initialize(path) @path = path.is_a?(::Pathname) ? path : ::Pathname.new(path.to_s) end
def source_absolute(source_relative)
def source_absolute(source_relative) ::File.expand_path(source_relative, path) end