Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove incremental generation #388

Merged
merged 1 commit into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .rubocop.yml
Expand Up @@ -124,7 +124,6 @@ Naming/MemoizedInstanceVariableName:
Security/MarshalLoad:
Exclude:
- !ruby/regexp /bridgetown-core/test\/.*.rb$/
- bridgetown-core/lib/bridgetown-core/regenerator.rb
Security/YAMLLoad:
Exclude:
- !ruby/regexp /bridgetown-core/features\/.*.rb/
Expand Down
68 changes: 0 additions & 68 deletions bridgetown-core/features/incremental_rebuild.feature

This file was deleted.

2 changes: 0 additions & 2 deletions bridgetown-core/lib/bridgetown-core.rb
Expand Up @@ -100,8 +100,6 @@ module Bridgetown
autoload :Publishable, "bridgetown-core/concerns/publishable"
autoload :Publisher, "bridgetown-core/publisher"
autoload :Reader, "bridgetown-core/reader"
# TODO: remove this when the incremental regenerator is gone:
autoload :Regenerator, "bridgetown-core/regenerator"
autoload :RelatedPosts, "bridgetown-core/related_posts"
autoload :Renderer, "bridgetown-core/renderer"
autoload :LiquidRenderable, "bridgetown-core/concerns/liquid_renderable"
Expand Down
8 changes: 0 additions & 8 deletions bridgetown-core/lib/bridgetown-core/cleaner.rb
Expand Up @@ -13,7 +13,6 @@ def initialize(site)
# Cleans up the site's destination directory
def cleanup!
FileUtils.rm_rf(obsolete_files)
FileUtils.rm_rf(metadata_file) unless @site.incremental?
end

private
Expand All @@ -28,13 +27,6 @@ def obsolete_files
out
end

# Private: The metadata file storing dependency tree and build history
#
# Returns an Array with the metdata file as the only item
def metadata_file
[site.regenerator.metadata_file]
end

# Private: The list of existing files, apart from those included in
# keep_files and hidden files.
#
Expand Down
3 changes: 0 additions & 3 deletions bridgetown-core/lib/bridgetown-core/commands/build.rb
Expand Up @@ -64,9 +64,6 @@ def build_site(config_options)
Bridgetown.logger.info "Unpublished mode:",
"enabled. Processing documents marked unpublished"
end
incremental = config_options["incremental"]
Bridgetown.logger.info "Incremental build:",
(incremental ? "enabled" : "disabled. Enable with --incremental")
Bridgetown.logger.info "Generating…"
@site.process
Bridgetown.logger.info "Done! 🎉", "#{"Completed".green} in less than" \
Expand Down
Expand Up @@ -63,10 +63,6 @@ def self.extended(klass)
aliases: "-V",
type: :boolean,
desc: "Print verbose output."
klass.class_option :incremental,
aliases: "-I",
type: :boolean,
desc: "Enable incremental rebuild."
klass.class_option :strict_front_matter,
type: :boolean,
desc: "Fail if errors are present in front matter"
Expand Down
12 changes: 0 additions & 12 deletions bridgetown-core/lib/bridgetown-core/concerns/site/configurable.rb
Expand Up @@ -62,18 +62,6 @@ def frontmatter_defaults
@frontmatter_defaults ||= Bridgetown::FrontmatterDefaults.new(self)
end

# Whether to perform a full rebuild without incremental regeneration.
# If either `override["incremental"]` or `config["incremental"]` are true,
# fully rebuild the site. If not, incrementally build the site.
#
# @param [Hash] override
# An override hash to override the current config value
# @option override [Boolean] "incremental" Whether to incrementally build
# @return [Boolean] true for full rebuild, false for normal build
def incremental?(override = {})
override["incremental"] || config["incremental"]
end

# Returns the current instance of {Publisher} or creates a new instance of
# {Publisher} if one doesn't exist.
#
Expand Down
Expand Up @@ -39,7 +39,6 @@ def reset
@collections = nil
@documents = nil
@docs_to_write = nil
@regenerator.clear_cache
@liquid_renderer.reset
frontmatter_defaults.reset

Expand Down
24 changes: 11 additions & 13 deletions bridgetown-core/lib/bridgetown-core/concerns/site/renderable.rb
Expand Up @@ -55,7 +55,7 @@ def render_docs
collections.each_value do |collection|
collection.docs.each do |document|
render_with_locale(document) do
render_regenerated document
render_item document
end
end

Expand All @@ -71,32 +71,30 @@ def render_docs
# @return [void]
def render_pages
pages.each do |page|
render_regenerated page
render_item page
end
end

# Renders a document while ensuring site locale is set if the data is available.
# @param document [Document] The document to render
# Renders a content item while ensuring site locale is set if the data is available.
# @param item [Document, Page, Bridgetown::Resource::Base] The item to render
# @yield Runs the block in between locale setting and resetting
# @return [void]
def render_with_locale(document)
if document.data["locale"]
def render_with_locale(item)
if item.data["locale"]
previous_locale = locale
self.locale = document.data["locale"]
self.locale = item.data["locale"]
yield
self.locale = previous_locale
else
yield
end
end

# Regenerates a site using {Renderer}
# @param document [Document] The document to regenerate.
# Regenerates a content item using {Renderer}
# @param item [Document, Page] The document or page to regenerate.
# @return [void]
def render_regenerated(document)
return unless regenerator.regenerate?(document)

Bridgetown::Renderer.new(self, document).run
def render_item(item)
Bridgetown::Renderer.new(self, item).run
end
end
end
Expand Up @@ -13,10 +13,7 @@ def cleanup
#
# @return [void]
def write
each_site_file do |item|
item.write(dest) if regenerator.regenerate?(item)
end
regenerator.write_metadata
each_site_file { |item| item.write(dest) }
Bridgetown::Hooks.trigger :site, :post_write, self
end

Expand Down
1 change: 0 additions & 1 deletion bridgetown-core/lib/bridgetown-core/configuration.rb
Expand Up @@ -48,7 +48,6 @@ class Configuration < HashWithDotAccess::Hash
"highlighter" => "rouge",
"lsi" => false,
"excerpt_separator" => "\n\n",
"incremental" => false,

# Serving
"detach" => false, # default to not detaching the server
Expand Down