lib/json_matchers/matcher.rb in json_matchers-0.11.0 vs lib/json_matchers/matcher.rb in json_matchers-0.11.1
- old
+ new
@@ -29,15 +29,21 @@
end
def build_and_populate_document_store
document_store = JsonSchema::DocumentStore.new
- Dir.glob("#{JsonMatchers.schema_root}/**/*.json").
+ traverse_schema_root_with_first_level_symlinks.
map { |path| Pathname.new(path) }.
map { |schema_path| Parser.new(schema_path).parse }.
map { |schema| document_store.add_schema(schema) }.
each { |schema| schema.expand_references!(store: document_store) }
document_store
+ end
+
+ def traverse_schema_root_with_first_level_symlinks
+ # follow one symlink and direct children
+ # http://stackoverflow.com/questions/357754/can-i-traverse-symlinked-directories-in-ruby-with-a-glob
+ Dir.glob("#{JsonMatchers.schema_root}/**{,/*/**}/*.json")
end
end
end