lib/grape/reload/dependency_map.rb in grape-reload-0.0.4 vs lib/grape/reload/dependency_map.rb in grape-reload-0.1.0
- old
+ new
@@ -22,10 +22,17 @@
end
def initialize(sources)
@sources = sources
files = @sources.map{|p| Dir[p]}.flatten.uniq
- @map = Hash[files.zip(files.map{|file| Ripper.extract_constants(File.read(file))})]
+ @map = Hash[files.zip(files.map do |file|
+ begin
+ Ripper.extract_constants(File.read(file))
+ rescue
+ Grape::RackBuilder.logger.error("Theres is an error while parsing #{file}")
+ []
+ end
+ end)]
end
def sorted_files
tsort
end
\ No newline at end of file