lib/berkshelf/validator.rb in berkshelf-6.2.2 vs lib/berkshelf/validator.rb in berkshelf-6.3.0

- old
+ new

@@ -22,12 +22,15 @@ # the Cookbook(s) to validate def validate_files(cookbooks) Array(cookbooks).each do |cookbook| path = cookbook.path.to_s - files = Dir.glob(File.join(path, "**", "*.rb")).select do |f| - parent = Pathname.new(path).dirname.to_s - f.gsub(parent, "") =~ /[[:space:]]/ + files = Dir.chdir(path) do + Dir.glob(File.join("**", "*.rb")).select do |f| + f = File.join(path, f) + parent = Pathname.new(path).dirname.to_s + f.gsub(parent, "") =~ /[[:space:]]/ + end end raise InvalidCookbookFiles.new(cookbook, files) unless files.empty? end end