lib/nanoc/base/services/pruner.rb in nanoc-4.7.12 vs lib/nanoc/base/services/pruner.rb in nanoc-4.7.13
- old
+ new
@@ -44,10 +44,22 @@
# @param [String] filename The filename to check
#
# @return [Boolean] true if the given file is excluded, false otherwise
def filename_excluded?(filename)
pathname = Pathname.new(filename)
- @exclude.any? { |e| pathname.__nanoc_include_component?(e) }
+ @exclude.any? { |e| pathname_components(pathname).include?(e) }
+ end
+
+ def pathname_components(pathname)
+ components = []
+ tmp = pathname
+ loop do
+ old = tmp
+ components << File.basename(tmp)
+ tmp = File.dirname(tmp)
+ break if old == tmp
+ end
+ components.reverse
end
# @api private
def remove_stray_files(present_files, compiled_files)
(present_files - compiled_files).each do |f|