Class: Nanoc::Core::SiteLoader

Inherits:
Object
  • Object
show all
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}/.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.cwd_is_nanoc_site?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/nanoc/core/site_loader.rb', line 13

def self.cwd_is_nanoc_site?
  Nanoc::Core::ConfigLoader.cwd_is_nanoc_site?
end

Instance Method Details

#gen_data_source_for_config(config) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/nanoc/core/site_loader.rb', line 17

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_cwdObject



8
9
10
# File 'lib/nanoc/core/site_loader.rb', line 8

def new_from_cwd
  site_from_config(Nanoc::Core::ConfigLoader.new.new_from_cwd)
end