Class: Marsdawn::Builder
- Inherits:
-
Object
- Object
- Marsdawn::Builder
- Defined in:
- lib/marsdawn/builder.rb
Class Method Summary collapse
- .build(config) ⇒ Object
- .build_source(source, storage, options) ⇒ Object
- .create_search_index(storage, options) ⇒ Object
Class Method Details
.build(config) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/marsdawn/builder.rb', line 7 def self.build config raise "No specification for source path." unless config.key?(:source) raise "No specification for storage config." unless config.key?(:storage) source = Marsdawn::Source.new(config[:source]) storage = Marsdawn::Storage.get(config[:storage], source.doc_info) build_source source, storage, config[:build_options] create_search_index storage, config[:search] if config.key?(:search) end |
.build_source(source, storage, options) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/marsdawn/builder.rb', line 16 def self.build_source source, storage, ||= {} = [:kramdown] || {} storage.prepare storage.set_document_info source.doc_info source.each_contents() do |uri, content, front_matter, sysinfo| storage.set uri, content, front_matter, sysinfo end storage.finalize rescue => ex storage.clean_up raise ex end |
.create_search_index(storage, options) ⇒ Object
30 31 32 33 |
# File 'lib/marsdawn/builder.rb', line 30 def self.create_search_index storage, ||= {} Marsdawn::Search.create_index storage, end |