Class: Bridgetown::Site
- Inherits:
-
Object
- Object
- Bridgetown::Site
- Includes:
- Configurable, Content, Extensible, FastRefreshable, Localizable, Processable, Renderable, SSR, Writable
- Defined in:
- lib/bridgetown-core/site.rb,
lib/bridgetown-core/concerns/site/ssr.rb,
lib/bridgetown-core/concerns/site/content.rb,
lib/bridgetown-core/concerns/site/writable.rb,
lib/bridgetown-core/concerns/site/extensible.rb,
lib/bridgetown-core/concerns/site/renderable.rb,
lib/bridgetown-core/concerns/site/localizable.rb,
lib/bridgetown-core/concerns/site/processable.rb,
lib/bridgetown-core/concerns/site/configurable.rb,
lib/bridgetown-core/concerns/site/fast_refreshable.rb
Defined Under Namespace
Modules: Configurable, Content, Extensible, FastRefreshable, Localizable, Processable, Renderable, SSR, Writable
Instance Attribute Summary collapse
-
#cache_dir ⇒ Object
readonly
Returns the value of attribute cache_dir.
- #config ⇒ Bridgetown::Configuration readonly
-
#converters ⇒ Object
Returns the value of attribute converters.
-
#data ⇒ Object
Returns the value of attribute data.
-
#fast_refresh_ordering ⇒ Object
Returns the value of attribute fast_refresh_ordering.
-
#file_read_opts ⇒ Object
Returns the value of attribute file_read_opts.
- #generated_pages ⇒ Array<GeneratedPage>
-
#generators ⇒ Object
Returns the value of attribute generators.
- #label ⇒ Symbol readonly
- #layouts ⇒ Array<Layout>
-
#liquid_renderer ⇒ Object
readonly
Returns the value of attribute liquid_renderer.
- #loaders_manager ⇒ Bridgetown::Utils::LoadersManager readonly
-
#permalink_style ⇒ Object
Returns the value of attribute permalink_style.
-
#plugin_manager ⇒ Object
Returns the value of attribute plugin_manager.
-
#reader ⇒ Object
Returns the value of attribute reader.
-
#signals ⇒ Object
readonly
Returns the value of attribute signals.
-
#static_files ⇒ Array<StaticFile>
All files not pages/documents or structured data in the source folder.
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
-
#ensure_not_in_dest ⇒ Object
Check that the destination dir isn't the source dir or a directory parent to the source dir.
-
#initialize(config, label: :main, loaders_manager: nil) ⇒ Site
constructor
Initialize a new Site.
- #inspect ⇒ Object
- #tmp_cache ⇒ Object
Methods included from Writable
#cleanup, #each_site_file, #resources_cache_manifest, #write, #write_redirecting_index
Methods included from SSR
#disable_ssr, #enable_ssr, included, #ssr?, #ssr_first_read, #ssr_setup
Methods included from Renderable
#execute_inline_ruby_for_layouts!, #matched_converters_for_convertible, #render, #render_resources, #render_with_locale, #validated_layouts_for, #warn_on_missing_layout
Methods included from Processable
#process, #read, #refresh_layouts_and_data, #reset
Methods included from Localizable
Methods included from FastRefreshable
Methods included from Extensible
#find_converter_instance, #generate, #instantiate_subclasses, #on, #setup
Methods included from Content
#add_generated_page, #categories, #collection_names, #collections, #frontend_manifest, #metadata, #resources, #resources_grouped_by_taxonomy, #resources_to_write, #site_payload, #static_files_to_write, #tags, #taxonomies, #taxonomy_types
Methods included from Configurable
#base_path, #collections_path, #config=, #defaults_reader, #destination, #frontend_bundling_path, #frontmatter_defaults, #in_cache_dir, #in_destination_dir, #in_root_dir, #in_source_dir, #root_dir, #source
Constructor Details
#initialize(config, label: :main, loaders_manager: nil) ⇒ Site
Initialize a new Site.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/bridgetown-core/site.rb', line 46 def initialize(config, label: :main, loaders_manager: nil) @label = label.to_sym self.config = config locale loaders_manager = if loaders_manager loaders_manager.config = self.config loaders_manager else Bridgetown::Utils::LoadersManager.new(self.config) end @loaders_manager = loaders_manager @plugin_manager = PluginManager.new(self) @cleaner = Cleaner.new(self) @reader = Reader.new(self) @liquid_renderer = LiquidRenderer.new(self) Bridgetown::Cache.base_cache["site_tmp"] = HashWithDotAccess::Hash.new ensure_not_in_dest Bridgetown::Current.sites[@label] = self Bridgetown::Hooks.trigger :site, :after_init, self reset # Processable setup # Extensible end |
Instance Attribute Details
#cache_dir ⇒ Object (readonly)
Returns the value of attribute cache_dir.
26 27 28 |
# File 'lib/bridgetown-core/site.rb', line 26 def cache_dir @cache_dir end |
#config ⇒ Bridgetown::Configuration (readonly)
18 19 20 |
# File 'lib/bridgetown-core/site.rb', line 18 def config @config end |
#converters ⇒ Object
Returns the value of attribute converters.
38 39 40 |
# File 'lib/bridgetown-core/site.rb', line 38 def converters @converters end |
#data ⇒ Object
Returns the value of attribute data.
26 27 28 |
# File 'lib/bridgetown-core/site.rb', line 26 def data @data end |
#fast_refresh_ordering ⇒ Object
Returns the value of attribute fast_refresh_ordering.
38 39 40 |
# File 'lib/bridgetown-core/site.rb', line 38 def fast_refresh_ordering @fast_refresh_ordering end |
#file_read_opts ⇒ Object
Returns the value of attribute file_read_opts.
38 39 40 |
# File 'lib/bridgetown-core/site.rb', line 38 def file_read_opts @file_read_opts end |
#generated_pages ⇒ Array<GeneratedPage>
36 37 38 |
# File 'lib/bridgetown-core/site.rb', line 36 def generated_pages @generated_pages end |
#generators ⇒ Object
Returns the value of attribute generators.
38 39 40 |
# File 'lib/bridgetown-core/site.rb', line 38 def generators @generators end |
#label ⇒ Symbol (readonly)
21 22 23 |
# File 'lib/bridgetown-core/site.rb', line 21 def label @label end |
#layouts ⇒ Array<Layout>
33 34 35 |
# File 'lib/bridgetown-core/site.rb', line 33 def layouts @layouts end |
#liquid_renderer ⇒ Object (readonly)
Returns the value of attribute liquid_renderer.
26 27 28 |
# File 'lib/bridgetown-core/site.rb', line 26 def liquid_renderer @liquid_renderer end |
#loaders_manager ⇒ Bridgetown::Utils::LoadersManager (readonly)
24 25 26 |
# File 'lib/bridgetown-core/site.rb', line 24 def loaders_manager @loaders_manager end |
#permalink_style ⇒ Object
Returns the value of attribute permalink_style.
38 39 40 |
# File 'lib/bridgetown-core/site.rb', line 38 def permalink_style @permalink_style end |
#plugin_manager ⇒ Object
Returns the value of attribute plugin_manager.
38 39 40 |
# File 'lib/bridgetown-core/site.rb', line 38 def plugin_manager @plugin_manager end |
#reader ⇒ Object
Returns the value of attribute reader.
38 39 40 |
# File 'lib/bridgetown-core/site.rb', line 38 def reader @reader end |
#signals ⇒ Object (readonly)
Returns the value of attribute signals.
26 27 28 |
# File 'lib/bridgetown-core/site.rb', line 26 def signals @signals end |
#static_files ⇒ Array<StaticFile>
All files not pages/documents or structured data in the source folder
30 31 32 |
# File 'lib/bridgetown-core/site.rb', line 30 def static_files @static_files end |
#time ⇒ Object
Returns the value of attribute time.
38 39 40 |
# File 'lib/bridgetown-core/site.rb', line 38 def time @time end |
Instance Method Details
#ensure_not_in_dest ⇒ Object
Check that the destination dir isn't the source dir or a directory parent to the source dir.
93 94 95 96 97 98 99 100 101 |
# File 'lib/bridgetown-core/site.rb', line 93 def ensure_not_in_dest dest_pathname = Pathname.new(dest) Pathname.new(source).ascend do |path| if path == dest_pathname raise Errors::FatalException, "Destination directory cannot be or contain the Source directory." end end end |
#inspect ⇒ Object
107 108 109 |
# File 'lib/bridgetown-core/site.rb', line 107 def inspect "#<Bridgetown::Site #{.inspect.delete_prefix("{").delete_suffix("}")}>" end |
#tmp_cache ⇒ Object
103 104 105 |
# File 'lib/bridgetown-core/site.rb', line 103 def tmp_cache Bridgetown::Cache.base_cache["site_tmp"] end |