lib/avro/builder/file_handler.rb in avro-builder-0.3.1 vs lib/avro/builder/file_handler.rb in avro-builder-0.3.2

- old
+ new

@@ -20,17 +20,21 @@ end private def find_file(name) - file_name = "#{name.to_s.sub(/\.rb$/, '')}.rb" + # Ensure that the file_name that is searched for begins with a slash (/) + # and ends with a .rb extension. Additionally, if the name contains + # a namespace then ensure that periods (.) are replaced by forward + # slashes. E.g. for 'test.example' search for '/test/example.rb'. + file_name = "/#{name.to_s.gsub('.', '/').sub(/^\//, '').sub(/\.rb$/, '')}.rb" matches = self.class.load_paths.flat_map do |load_path| Dir["#{load_path}/**/*.rb"].select do |file_path| file_path.end_with?(file_name) end end raise "Multiple matches: #{matches}" if matches.size > 1 - raise "File not found #{name}" if matches.empty? + raise "File not found #{file_name}" if matches.empty? matches.first end end