lib/trailblazer/loader.rb in trailblazer-loader-0.1.1 vs lib/trailblazer/loader.rb in trailblazer-loader-0.1.2

- old
+ new

@@ -14,16 +14,11 @@ def call(options={}, &block) options[:root] ||= "." options[:concepts_root] ||= "#{options[:root]}/app/concepts/" options[:concept_dirs] ||= concept_dirs - pipeline = options[:pipeline] || Pipeline[ - FindDirectories, - FindConcepts, - SortByLevel, - Pipeline::Collect[ConceptName, ConceptFiles, SortCreateFirst, SortOperationLast, AddConceptFiles] # per concept. - ] + pipeline = options[:pipeline] || default_circuit if args = options[:insert] # FIXME: this only implements a sub-set. # pipeline = Representable::Pipeline::Insert.(pipeline, *args) # FIXME: implement :before in Pipeline. pipeline.last.insert(pipeline.last.index(args.last[:before]), args.first) end @@ -34,9 +29,18 @@ files = pipeline.([], options).flatten debug(files, options) load_files(files, &block) + end + + def default_circuit + Pipeline[ + FindDirectories, + FindConcepts, + SortByLevel, + Pipeline::Collect[ConceptName, ConceptFiles, SortCreateFirst, SortOperationLast, AddConceptFiles] # per concept. + ] end def debug(files, options) pp files if options[:debug] end