lib/lookbook/support/utils/path_utils.rb in lookbook-1.2.1 vs lib/lookbook/support/utils/path_utils.rb in lookbook-1.3.0
- old
+ new
@@ -4,16 +4,19 @@
def to_absolute(path)
File.absolute_path(path.to_s, Rails.root)
end
def normalize_all(paths, allow_root: false)
- root = Rails.application.root.to_s
- paths.map do |path|
+ Array(paths).map do |path|
full_path = to_absolute(path)
if Dir.exist?(full_path)
- full_path if allow_root || full_path.to_s != root
+ full_path if allow_root || !root_path?(full_path)
end
end.compact.uniq
+ end
+
+ def root_path?(path)
+ Rails.application.root.to_s == path.to_s
end
end
end
end