Class: Bridgetown::Site
- Inherits:
-
Object
- Object
- Bridgetown::Site
- Includes:
- Configurable, Content, Extensible, 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
Defined Under Namespace
Modules: Configurable, Content, Extensible, 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.
-
#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.
-
#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_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 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, #baseurl, #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, #uses_resource?
Constructor Details
#initialize(config, label: :main, loaders_manager: nil) ⇒ Site
Initialize a new Site.
45 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 |
# File 'lib/bridgetown-core/site.rb', line 45 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"] = {}.with_dot_access 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.
25 26 27 |
# File 'lib/bridgetown-core/site.rb', line 25 def cache_dir @cache_dir end |
#config ⇒ Bridgetown::Configuration (readonly)
17 18 19 |
# File 'lib/bridgetown-core/site.rb', line 17 def config @config end |
#converters ⇒ Object
Returns the value of attribute converters.
37 38 39 |
# File 'lib/bridgetown-core/site.rb', line 37 def converters @converters end |
#data ⇒ Object
Returns the value of attribute data.
37 38 39 |
# File 'lib/bridgetown-core/site.rb', line 37 def data @data end |
#file_read_opts ⇒ Object
Returns the value of attribute file_read_opts.
37 38 39 |
# File 'lib/bridgetown-core/site.rb', line 37 def file_read_opts @file_read_opts end |
#generated_pages ⇒ Array<GeneratedPage>
35 36 37 |
# File 'lib/bridgetown-core/site.rb', line 35 def generated_pages @generated_pages end |
#generators ⇒ Object
Returns the value of attribute generators.
37 38 39 |
# File 'lib/bridgetown-core/site.rb', line 37 def generators @generators end |
#label ⇒ Symbol (readonly)
20 21 22 |
# File 'lib/bridgetown-core/site.rb', line 20 def label @label end |
#layouts ⇒ Array<Layout>
32 33 34 |
# File 'lib/bridgetown-core/site.rb', line 32 def layouts @layouts end |
#liquid_renderer ⇒ Object (readonly)
Returns the value of attribute liquid_renderer.
25 26 27 |
# File 'lib/bridgetown-core/site.rb', line 25 def liquid_renderer @liquid_renderer end |
#loaders_manager ⇒ Bridgetown::Utils::LoadersManager (readonly)
23 24 25 |
# File 'lib/bridgetown-core/site.rb', line 23 def loaders_manager @loaders_manager end |
#permalink_style ⇒ Object
Returns the value of attribute permalink_style.
37 38 39 |
# File 'lib/bridgetown-core/site.rb', line 37 def permalink_style @permalink_style end |
#plugin_manager ⇒ Object
Returns the value of attribute plugin_manager.
37 38 39 |
# File 'lib/bridgetown-core/site.rb', line 37 def plugin_manager @plugin_manager end |
#reader ⇒ Object
Returns the value of attribute reader.
37 38 39 |
# File 'lib/bridgetown-core/site.rb', line 37 def reader @reader end |
#static_files ⇒ Array<StaticFile>
All files not pages/documents or structured data in the source folder
29 30 31 |
# File 'lib/bridgetown-core/site.rb', line 29 def static_files @static_files end |
#time ⇒ Object
Returns the value of attribute time.
37 38 39 |
# File 'lib/bridgetown-core/site.rb', line 37 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.
75 76 77 78 79 80 81 82 83 |
# File 'lib/bridgetown-core/site.rb', line 75 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
89 90 91 |
# File 'lib/bridgetown-core/site.rb', line 89 def inspect "#<Bridgetown::Site #{.inspect.delete_prefix("{").delete_suffix("}")}>" end |
#tmp_cache ⇒ Object
85 86 87 |
# File 'lib/bridgetown-core/site.rb', line 85 def tmp_cache Bridgetown::Cache.base_cache["site_tmp"] end |