lib/brief/repository.rb in brief-1.5.0 vs lib/brief/repository.rb in brief-1.5.1
- old
+ new
@@ -16,11 +16,12 @@
load_documents
end
def document_at(path)
path = normalize_path(path)
- Brief::Document.new(path)
+ found = documents.find {|doc| doc.path == path }
+ found || Brief::Document.new(path).in_briefcase(briefcase)
end
def documents_at!(*paths)
documents_at(*paths).select {|doc| doc.path.exist? }
end
@@ -32,10 +33,10 @@
def documents_at(*paths)
paths.compact!
paths.map! {|p| normalize_path(p) }
- paths.map {|p| p && Brief::Document.new(p)}
+ paths.map {|p| p && document_at(p) }
end
def models_at(*paths)
documents_at(*paths).map(&:to_model)
end