Returns a hash that maps filenames under dir (recursively) to
arrays with their annotations. Only files with annotations are included,
and only those with extension .builder,.rb,.erb,.haml and .slim are taken into account.
# File railties/lib/rails/source_annotation_extractor.rb, line 58
def find_in(dir)
results = {}
Dir.glob("#{dir}/*") do |item|
next if File.basename(item)[0] == ..
if File.directory?(item)
results.update(find_in(item))
elsif item =~ /\.(builder|rb)$/
results.update(extract_annotations_from(item, /#\s*(#{tag}):?\s*(.*)$/))
elsif item =~ /\.erb$/
results.update(extract_annotations_from(item, /<%\s*#\s*(#{tag}):?\s*(.*?)\s*%>/))
elsif item =~ /\.haml$/
results.update(extract_annotations_from(item, /-\s*#\s*(#{tag}):?\s*(.*)$/))
elsif item =~ /\.slim$/
results.update(extract_annotations_from(item, /\/\s*\s*(#{tag}):?\s*(.*)$/))
end
end
results
end