lib/nanoc/data_sources/filesystem.rb in nanoc-3.6.2 vs lib/nanoc/data_sources/filesystem.rb in nanoc-3.6.3
- old
+ new
@@ -50,11 +50,11 @@
# See {Nanoc::DataSource#create_layout}.
def create_layout(content, attributes, identifier, params={})
create_object('layouts', content, attributes, identifier, params)
end
- private
+ protected
# Creates a new object (item or layout) on disk in dir_name according to
# the given identifier. The file will have its attributes taken from the
# attributes hash argument and its content from the content argument.
def create_object(dir_name, content, attributes, identifier, params={})
@@ -142,11 +142,11 @@
# 'content/bar' => [ 'yaml', nil ],
# 'content/qux' => [ nil, 'html' ]
# }
def all_split_files_in(dir_name)
# Get all good file names
- filenames = Dir[dir_name + '/**/*'].select { |i| File.file?(i) }
+ filenames = self.all_files_in(dir_name)
filenames.reject! { |fn| fn =~ /(~|\.orig|\.rej|\.bak)$/ }
# Group by identifier
grouped_filenames = filenames.group_by { |fn| basename_of(fn) }
@@ -169,9 +169,14 @@
filenames[1] = content_filenames[0] ? ext_of(content_filenames[0])[1..-1] || '': nil
end
# Done
grouped_filenames
+ end
+
+ # Returns all files in the given directory and directories below it.
+ def all_files_in(dir_name)
+ Nanoc::Extra::FilesystemTools.all_files_in(dir_name)
end
# Returns the filename for the given base filename and the extension.
#
# If the extension is nil, this function should return nil as well.