lib/brief/repository.rb in brief-1.3.2 vs lib/brief/repository.rb in brief-1.4.1

- old
+ new

@@ -14,10 +14,35 @@ @options = options load_documents end + def document_at(path) + path = normalize_path(path) + Brief::Document.new(path) + end + + def documents_at!(*paths) + documents_at(*paths).select {|doc| doc.path.exist? } + end + + def normalize_path(p) + docs_path.join(p) + end + + def documents_at(*paths) + paths.compact! + + paths.map! {|p| normalize_path(p) } + + paths.map {|p| p && Brief::Document.new(p)} + end + + def models_at(*paths) + documents_at(*paths).map(&:to_model) + end + def documents return @documents if @documents load_documents end @@ -31,12 +56,16 @@ def root briefcase.root end + def docs_path + briefcase.docs_path + end + def load_documents @documents = document_paths.map do |path| - Brief::Document.new(path) + Brief::Document.new(path).in_briefcase(briefcase) end end def document_paths Dir[root.join('**/*.md').to_s].map { |p| Pathname(p) }