lib/nanoc/data_sources/filesystem/tools.rb in nanoc-4.9.3 vs lib/nanoc/data_sources/filesystem/tools.rb in nanoc-4.9.4
- old
+ new
@@ -31,10 +31,12 @@
@filename = filename
super("The file at #{filename} is of an unsupported type (expected file, directory or link, but it is #{File.ftype(filename)}")
end
end
+ module_function
+
# Returns all files in the given directory and directories below it,
# following symlinks up to a maximum of `recursion_limit` times.
#
# @param [String] dir_name The name of the directory whose contents to
# fetch
@@ -76,11 +78,10 @@
else
raise UnsupportedFileTypeError.new(fn)
end
end.compact.flatten
end
- module_function :all_files_in
# Returns all files and directories in the given directory and
# directories below it.
#
# @param [String] dir_name The name of the directory whose contents to
@@ -112,11 +113,10 @@
end
patterns = base_patterns + extra_patterns
Dir.glob(patterns)
end
- module_function :all_files_and_dirs_in
# Resolves the given symlink into an absolute path.
#
# @param [String] filename The filename of the symlink to resolve
#
@@ -145,11 +145,10 @@
absolute_target
else
raise UnsupportedFileTypeError.new(absolute_target)
end
end
- module_function :resolve_symlink
# Reads the content of the file with the given name and returns a string
# in UTF-8 encoding. The original encoding of the string is derived from
# the default external encoding, but this can be overridden by the
# “encoding” configuration attribute in the data source configuration.
@@ -184,8 +183,7 @@
# Remove UTF-8 BOM (ugly)
data.delete!("\xEF\xBB\xBF")
data
end
- module_function :read_file
end
end