Class: Nanoc::Core::SiteLoader
- Inherits:
-
Object
- Object
- Nanoc::Core::SiteLoader
- Defined in:
- lib/nanoc/core/site_loader.rb
Constant Summary collapse
- ENCODING_REGEX =
/\A#\s+(-\*-\s+)?(en)?coding: (?<encoding>[^\s]+)(\s+-\*-\s*)?\n{0,2}/
Class Method Summary collapse
Instance Method Summary collapse
- #gen_data_source_for_config(config) ⇒ Object
- #new_from_config(config) ⇒ Object
- #new_from_cwd ⇒ Object
Class Method Details
.cwd_is_nanoc_site? ⇒ Boolean
10 11 12 |
# File 'lib/nanoc/core/site_loader.rb', line 10 def self.cwd_is_nanoc_site? Nanoc::Core::ConfigLoader.cwd_is_nanoc_site? end |
Instance Method Details
#gen_data_source_for_config(config) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/nanoc/core/site_loader.rb', line 18 def gen_data_source_for_config(config) data_sources_to_aggregate = with_data_sources(config) do |data_sources| data_sources.map do |ds| Nanoc::Core::PrefixedDataSource.new( ds, ds.items_root, ds.layouts_root ) end end Nanoc::Core::AggregateDataSource.new(data_sources_to_aggregate, config) end |
#new_from_config(config) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/nanoc/core/site_loader.rb', line 31 def new_from_config(config) Nanoc::Core::Instrumentor.call(:stage_ran, 'LoadSite') do code_snippets = code_snippets_from_config(config) code_snippets.each(&:load) data_source = gen_data_source_for_config(config) Nanoc::Core::Site.new( config:, code_snippets:, data_source:, ) end end |
#new_from_cwd ⇒ Object
14 15 16 |
# File 'lib/nanoc/core/site_loader.rb', line 14 def new_from_cwd new_from_config(Nanoc::Core::ConfigLoader.new.new_from_cwd) end |