From 5e703809a59f45943ed6795b7f3590f61092e0b7 Mon Sep 17 00:00:00 2001 From: Jared White Date: Thu, 28 Mar 2024 22:11:01 -0700 Subject: [PATCH] Remove a variety of deprecated code paths for v2 --- .../lib/bridgetown-builder/dsl/helpers.rb | 34 ++++------ .../lib/bridgetown-builder/plugin.rb | 17 +---- .../test/test_config_defaults.rb | 34 ---------- bridgetown-core/lib/bridgetown-core.rb | 13 +--- .../lib/bridgetown-core/collection.rb | 5 -- .../concerns/site/configurable.rb | 14 +--- .../bridgetown-core/drops/collection_drop.rb | 2 +- .../lib/bridgetown-core/drops/site_drop.rb | 5 -- .../lib/bridgetown-core/plugin_manager.rb | 66 +------------------ .../lib/bridgetown-core/rack/boot.rb | 11 ---- .../tasks/bridgetown_tasks.rake | 2 +- .../lib/bridgetown-core/utils/aux.rb | 6 -- bridgetown-core/test/ssr/server/roda_app.rb | 4 +- bridgetown-core/test/test_collections.rb | 4 +- bridgetown-core/test/test_configuration.rb | 32 ++++----- bridgetown-core/test/test_tags.rb | 2 +- bridgetown-website/Gemfile | 8 +-- bridgetown-website/Gemfile.lock | 49 +++++++------- bridgetown-website/config/initializers.rb | 8 +++ bridgetown-website/package.json | 2 +- bridgetown-website/server/roda_app.rb | 4 +- .../src/_docs/configuration/initializers.md | 6 -- bridgetown-website/src/_docs/plugins.md | 4 -- .../2022/2022-07-18-1.1-belmont-is-here.md | 2 +- .../2022-10-10-1.2-bonny-scope-next-level.md | 2 +- bridgetown-website/yarn.lock | 8 +-- 26 files changed, 89 insertions(+), 255 deletions(-) delete mode 100644 bridgetown-builder/test/test_config_defaults.rb create mode 100644 bridgetown-website/config/initializers.rb diff --git a/bridgetown-builder/lib/bridgetown-builder/dsl/helpers.rb b/bridgetown-builder/lib/bridgetown-builder/dsl/helpers.rb index 0819fbf8a..ca4f8974c 100644 --- a/bridgetown-builder/lib/bridgetown-builder/dsl/helpers.rb +++ b/bridgetown-builder/lib/bridgetown-builder/dsl/helpers.rb @@ -8,30 +8,22 @@ def helpers @helpers # could be nil end - def helper(helper_name, method_name = nil, helpers_scope: false, &block) + def helper(helper_name, method_name = nil, &block) m = Module.new - if block && helpers_scope - Deprecator.deprecation_message( - "The `helpers_scope' functionality is deprecated. Use the `helpers' builder " \ - "method to access the helpers scope in your plugin." - ) - m.define_method helper_name, &block - else - builder_self = self - method_name ||= helper_name unless block - unless method_name - method_name = :"__helper_#{helper_name}" - builder_self.define_singleton_method(method_name) do |*args, **kwargs, &block2| - block.(*args, **kwargs, &block2) - end + builder_self = self + method_name ||= helper_name unless block + unless method_name + method_name = :"__helper_#{helper_name}" + builder_self.define_singleton_method(method_name) do |*args, **kwargs, &block2| + block.(*args, **kwargs, &block2) end - m.define_method helper_name do |*args, **kwargs, &block2| - prev_var = builder_self.instance_variable_get(:@helpers) - builder_self.instance_variable_set(:@helpers, self) - builder_self.send(method_name, *args, **kwargs, &block2).tap do - builder_self.instance_variable_set(:@helpers, prev_var) - end + end + m.define_method helper_name do |*args, **kwargs, &block2| + prev_var = builder_self.instance_variable_get(:@helpers) + builder_self.instance_variable_set(:@helpers, self) + builder_self.send(method_name, *args, **kwargs, &block2).tap do + builder_self.instance_variable_set(:@helpers, prev_var) end end diff --git a/bridgetown-builder/lib/bridgetown-builder/plugin.rb b/bridgetown-builder/lib/bridgetown-builder/plugin.rb index 456d98e52..dda19c179 100644 --- a/bridgetown-builder/lib/bridgetown-builder/plugin.rb +++ b/bridgetown-builder/lib/bridgetown-builder/plugin.rb @@ -42,22 +42,7 @@ def initialize(name = nil, current_site = nil) self.name = name || self.class.name self.site = current_site || Bridgetown::Current.site - self.config = if defined?(self.class::CONFIG_DEFAULTS) - Deprecator.deprecation_message( - "Using `CONFIG_DEFAULTS' in your builder is deprecated. " \ - "Switch to defining config data via an initializer instead." - ) - Bridgetown::Utils.deep_merge_hashes( - self.class::CONFIG_DEFAULTS.with_dot_access, site.config - ) - else - site.config - end - end - - def doc(*) - raise Bridgetown::Errors::FatalException, - "The `doc' method has been removed. Please use the `new_resource' builder DSL instead" + self.config = site.config end end end diff --git a/bridgetown-builder/test/test_config_defaults.rb b/bridgetown-builder/test/test_config_defaults.rb deleted file mode 100644 index 3d95c44f1..000000000 --- a/bridgetown-builder/test/test_config_defaults.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -require "helper" - -class WithConfigBuilder < Builder - CONFIG_DEFAULTS = { - value: "test", - }.freeze - - attr_reader :value - - def build - @value = config[:value] - end -end - -class TestTagsDSL < BridgetownUnitTest - context "adding a Liquid tag" do - setup do - @site = Site.new(site_configuration) - end - - should "get the proper config" do - builder = WithConfigBuilder.new("Config Defaults", @site).build_with_callbacks - assert_equal "test", builder.value - end - - should "get the overridden site config" do - @site.config[:value] = "overridden" - builder = WithConfigBuilder.new("Overridden Config Defaults", @site).build_with_callbacks - assert_equal "overridden", builder.value - end - end -end diff --git a/bridgetown-core/lib/bridgetown-core.rb b/bridgetown-core/lib/bridgetown-core.rb index 4b1f329f4..7950d6070 100644 --- a/bridgetown-core/lib/bridgetown-core.rb +++ b/bridgetown-core/lib/bridgetown-core.rb @@ -267,7 +267,7 @@ def load_tasks unless Bridgetown::Current.preloaded_configuration Bridgetown::Current.preloaded_configuration = Bridgetown::Configuration::Preflight.new end - Bridgetown::PluginManager.setup_bundler(skip_yarn: true) + Bridgetown::PluginManager.setup_bundler if Bridgetown::Current.preloaded_configuration.is_a?(Bridgetown::Configuration::Preflight) Bridgetown::Current.preloaded_configuration = Bridgetown.configuration @@ -336,17 +336,6 @@ def logger=(writer) @logger = LogAdapter.new(writer, (ENV["BRIDGETOWN_LOG_LEVEL"] || :info).to_sym) end - # Deprecated. Now using the Current site. - # - # @return [Array] the Bridgetown sites created. - def sites - Deprecator.deprecation_message( - "Bridgetown.sites will be removed in the next version. Use Bridgetown::Current.sites" \ - "instead" - ) - [Bridgetown::Current.site].compact - end - # Ensures the questionable path is prefixed with the base directory # and prepends the questionable path with the base directory if false. # diff --git a/bridgetown-core/lib/bridgetown-core/collection.rb b/bridgetown-core/lib/bridgetown-core/collection.rb index adb8abe5d..34f410025 100644 --- a/bridgetown-core/lib/bridgetown-core/collection.rb +++ b/bridgetown-core/lib/bridgetown-core/collection.rb @@ -62,11 +62,6 @@ def static_files @static_files ||= [] end - def files - Bridgetown::Deprecator.deprecation_message "Collection#files is now Collection#static_files" - static_files - end - # Read the allowed resources into the collection's array of resources. # # @return [Bridgetown::Collection] self diff --git a/bridgetown-core/lib/bridgetown-core/concerns/site/configurable.rb b/bridgetown-core/lib/bridgetown-core/concerns/site/configurable.rb index bec6c4838..91e2e6fcd 100644 --- a/bridgetown-core/lib/bridgetown-core/concerns/site/configurable.rb +++ b/bridgetown-core/lib/bridgetown-core/concerns/site/configurable.rb @@ -28,29 +28,17 @@ def destination end alias_method :dest, :destination - def uses_resource? - Bridgetown::Deprecator.deprecation_message( - "The Site#uses_resource? method will be removed in the next version" - ) - true - end - # Returns a base path from which the site is served (aka `/cool-site`) or # `/` if served from root. # # @param strip_slash_only [Boolean] set to true if you wish "/" to be returned as "" # @return [String] def base_path(strip_slash_only: false) - (config[:base_path] || config[:baseurl]).then do |path| + config[:base_path].then do |path| strip_slash_only ? path.to_s.sub(%r{^/$}, "") : path end end - def baseurl - Bridgetown::Deprecator.deprecation_message "Site#baseurl is now Site#base_path" - base_path(strip_slash_only: true).presence - end - def defaults_reader @defaults_reader ||= Bridgetown::DefaultsReader.new(self) end diff --git a/bridgetown-core/lib/bridgetown-core/drops/collection_drop.rb b/bridgetown-core/lib/bridgetown-core/drops/collection_drop.rb index 0bdf8402e..268bf0fd6 100644 --- a/bridgetown-core/lib/bridgetown-core/drops/collection_drop.rb +++ b/bridgetown-core/lib/bridgetown-core/drops/collection_drop.rb @@ -8,7 +8,7 @@ class CollectionDrop < Drop mutable false def_delegator :@obj, :write?, :output - def_delegators :@obj, :label, :files, :relative_path, :resources, :static_files + def_delegators :@obj, :label, :relative_path, :resources, :static_files private def_delegator :@obj, :metadata, :fallback_data diff --git a/bridgetown-core/lib/bridgetown-core/drops/site_drop.rb b/bridgetown-core/lib/bridgetown-core/drops/site_drop.rb index 37ce8509c..a600806f0 100644 --- a/bridgetown-core/lib/bridgetown-core/drops/site_drop.rb +++ b/bridgetown-core/lib/bridgetown-core/drops/site_drop.rb @@ -8,7 +8,6 @@ class SiteDrop < Drop mutable false def_delegators :@obj, - :baseurl, # deprecated :base_path, :data, :locale, @@ -24,10 +23,6 @@ class SiteDrop < Drop attr_writer :current_document - def uses_resource - @obj.uses_resource? - end - def resources @resources ||= @obj.resources end diff --git a/bridgetown-core/lib/bridgetown-core/plugin_manager.rb b/bridgetown-core/lib/bridgetown-core/plugin_manager.rb index 1211d7392..823d683a0 100644 --- a/bridgetown-core/lib/bridgetown-core/plugin_manager.rb +++ b/bridgetown-core/lib/bridgetown-core/plugin_manager.rb @@ -2,44 +2,12 @@ module Bridgetown class PluginManager - LEGACY_PLUGINS_GROUP = :bridgetown_plugins YARN_DEPENDENCY_REGEXP = %r!(.+)@([^@]*)$! attr_reader :site, :loaders_manager @registered_plugins = Set.new - # @param source_manifest [Bridgetown::Configuration::SourceManifest] - def self.add_source_manifest(source_manifest) - unless source_manifest.is_a?(Bridgetown::Configuration::SourceManifest) - raise "You must add a SourceManifest instance" - end - - unless Bridgetown::Current.preloaded_configuration - raise "A preloaded configuration must be present before adding source manifests" - end - - Bridgetown::Deprecator.deprecation_message( - "The #{source_manifest.origin} plugin should switch from using `add_source_manifest' to " \ - "the `source_manifest` initializer method" - ) - - Bridgetown::Current.preloaded_configuration.source_manifests << source_manifest - end - - def self.new_source_manifest(*_args, **kwargs) - unless Bridgetown::Current.preloaded_configuration - raise "A preloaded configuration must be present before adding source manifests" - end - - Bridgetown::Deprecator.deprecation_message( - "The #{kwargs[:origin]} plugin should switch from using `new_source_manifest' to the " \ - "`source_manifest` initializer method" - ) - - add_source_manifest(Bridgetown::Configuration::SourceManifest.new(**kwargs)) - end - def self.add_registered_plugin(gem_or_plugin_file) @registered_plugins << gem_or_plugin_file end @@ -50,23 +18,15 @@ class << self def bundler_specs @bundler_specs ||= Bundler.load.requested_specs end - - def source_manifests - Bridgetown::Deprecator.deprecation_message( - "Use the configuration's `source_manifests` method instead of the plugin manager" - ) - - Bridgetown::Current.preloaded_configuration.source_manifests - end end - def self.setup_bundler(skip_yarn: false) + def self.setup_bundler if !ENV["BRIDGETOWN_NO_BUNDLER_REQUIRE"] && (Bundler::SharedHelpers.in_bundle? || Bridgetown.env.test?) require "bundler" require_relative "utils/initializers" - load_determined_bundler_environment(skip_yarn:) + load_determined_bundler_environment ENV["BRIDGETOWN_NO_BUNDLER_REQUIRE"] = "true" true @@ -78,7 +38,7 @@ class << self alias_method :require_from_bundler, :setup_bundler end - def self.load_determined_bundler_environment(skip_yarn: false) + def self.load_determined_bundler_environment boot_file = File.join("config", "boot.rb") if File.file?(boot_file) @@ -89,9 +49,6 @@ def self.load_determined_bundler_environment(skip_yarn: false) # Note: the default Bundler config will set up all gem groups, # see: https://bundler.io/guides/groups.html Bundler.setup(:default, Bridgetown.env) - else - # Only setup and require :bridgetown_plugins - legacy_yarn_and_register(legacy_require, skip_yarn:) end end @@ -112,23 +69,6 @@ def self.require_gem(name) "Registered #{plugin_to_register.name}") end - def self.legacy_require - Bundler.require(LEGACY_PLUGINS_GROUP).select do |dep| - dep.groups.intersect?([LEGACY_PLUGINS_GROUP]) && dep.should_include? - end - end - - def self.legacy_yarn_and_register(required_gems, skip_yarn: false) - install_yarn_dependencies(required_gems) unless skip_yarn - - required_gems.each do |installed_gem| - add_registered_plugin installed_gem - end - - Bridgetown.logger.debug("PluginManager:", - "Required #{required_gems.map(&:name).join(", ")}") - end - def self.package_manager @package_manager ||= if File.exist?("yarn.lock") "yarn" diff --git a/bridgetown-core/lib/bridgetown-core/rack/boot.rb b/bridgetown-core/lib/bridgetown-core/rack/boot.rb index 004d7f949..f99ad186b 100644 --- a/bridgetown-core/lib/bridgetown-core/rack/boot.rb +++ b/bridgetown-core/lib/bridgetown-core/rack/boot.rb @@ -13,17 +13,6 @@ module Bridgetown module Rack - class Roda < ::Roda - def self.inherited(klass) - Bridgetown::Deprecator.deprecation_message( - "The `Bridgetown::Rack::Roda' class will be removed in favor of using the " \ - "`bridgetown_server' plugin in a future version" - ) - super - klass.plugin :bridgetown_server - end - end - class << self # @return [Bridgetown::Utils::LoadersManager] attr_accessor :loaders_manager diff --git a/bridgetown-core/lib/bridgetown-core/tasks/bridgetown_tasks.rake b/bridgetown-core/lib/bridgetown-core/tasks/bridgetown_tasks.rake index eba68f266..27b807998 100644 --- a/bridgetown-core/lib/bridgetown-core/tasks/bridgetown_tasks.rake +++ b/bridgetown-core/lib/bridgetown-core/tasks/bridgetown_tasks.rake @@ -32,7 +32,7 @@ namespace :roda do task :routes do require "bridgetown-core/rack/boot" - Bridgetown::Rack::Roda.print_routes + Bridgetown::Rack::Routes.print_routes end end diff --git a/bridgetown-core/lib/bridgetown-core/utils/aux.rb b/bridgetown-core/lib/bridgetown-core/utils/aux.rb index 9d107c203..96532797b 100644 --- a/bridgetown-core/lib/bridgetown-core/utils/aux.rb +++ b/bridgetown-core/lib/bridgetown-core/utils/aux.rb @@ -43,12 +43,6 @@ def self.run_process(name, color, cmd, env: {}) end end - def self.group(&) - Bridgetown::Deprecator.deprecation_message "Bridgetown::Aux.group method will be removed" \ - "in a future version, use run_process" - instance_exec(&) - end - def self.kill_processes Bridgetown.logger.info "Stopping auxiliary processes..." running_pids.each do |pid| diff --git a/bridgetown-core/test/ssr/server/roda_app.rb b/bridgetown-core/test/ssr/server/roda_app.rb index 9405b1764..12bd3e605 100644 --- a/bridgetown-core/test/ssr/server/roda_app.rb +++ b/bridgetown-core/test/ssr/server/roda_app.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true -class RodaApp < Bridgetown::Rack::Roda +class RodaApp < Roda + plugin :bridgetown_server + # rubocop:disable Lint/EmptyBlock plugin(:common_logger, StringIO.new.tap do |io| # swallow logs in tests io.singleton_class.define_method(:level=) { |*| } diff --git a/bridgetown-core/test/test_collections.rb b/bridgetown-core/test/test_collections.rb index 77840f98c..8d5fd4b45 100644 --- a/bridgetown-core/test/test_collections.rb +++ b/bridgetown-core/test/test_collections.rb @@ -51,8 +51,8 @@ class TestCollections < BridgetownUnitTest assert_equal "methods", @collection.to_liquid["label"] end - should "have a files attribute" do - assert_equal [], @collection.to_liquid["files"] + should "have a static_files attribute" do + assert_equal [], @collection.to_liquid["static_files"] end should "have a relative_path attribute" do diff --git a/bridgetown-core/test/test_configuration.rb b/bridgetown-core/test/test_configuration.rb index 2092166b1..e8e28aeea 100644 --- a/bridgetown-core/test/test_configuration.rb +++ b/bridgetown-core/test/test_configuration.rb @@ -121,17 +121,17 @@ def default_config_fixture(overrides = {}) context "#stringify_keys" do setup do @mixed_keys = Configuration[{ - "markdown" => "kramdown", - :permalink => "date", - "baseurl" => "/", - :include => [".htaccess"], - :source => "./", + "markdown" => "kramdown", + :permalink => "date", + "base_path" => "/", + :include => [".htaccess"], + :source => "./", }] @string_keys = Configuration[{ "markdown" => "kramdown", "permalink" => "date", - "baseurl" => "/", + "base_path" => "/", "include" => [".htaccess"], "source" => "./", }] @@ -349,12 +349,12 @@ def default_config_fixture(overrides = {}) allow(Bridgetown::YAMLParser) .to receive(:load_file) .with(@paths[:other]) - .and_return("baseurl" => "http://example.com") + .and_return("base_path" => "http://example.com") allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:other]}") assert_equal \ site_configuration( - "baseurl" => "http://example.com", - "config" => @paths[:other] + "base_path" => "http://example.com", + "config" => @paths[:other] ), default_config_fixture({ "config" => @paths[:other] }) end @@ -364,12 +364,12 @@ def default_config_fixture(overrides = {}) allow(Bridgetown::YAMLParser) .to receive(:load_file) .with(@paths[:other]) - .and_return("baseurl" => "http://example.com") + .and_return("base_path" => "http://example.com") allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:other]}") assert_equal \ site_configuration( - "baseurl" => "http://example.com", - "config" => @paths[:other] + "base_path" => "http://example.com", + "config" => @paths[:other] ), default_config_fixture({ config: @paths[:other] }) end @@ -399,11 +399,11 @@ def default_config_fixture(overrides = {}) allow(Bridgetown::YAMLParser) .to receive(:load_file) .with(@paths[:default]) - .and_return("baseurl" => "http://example.dev") + .and_return("base_path" => "http://example.dev") allow(Bridgetown::YAMLParser) .to receive(:load_file) .with(@paths[:other]) - .and_return("baseurl" => "http://example.com") + .and_return("base_path" => "http://example.com") allow($stdout) .to receive(:puts) .with("Configuration file: #{@paths[:default]}") @@ -412,8 +412,8 @@ def default_config_fixture(overrides = {}) .with("Configuration file: #{@paths[:other]}") assert_equal \ site_configuration( - "baseurl" => "http://example.com", - "config" => [@paths[:default], @paths[:other]] + "base_path" => "http://example.com", + "config" => [@paths[:default], @paths[:other]] ), default_config_fixture({ "config" => [@paths[:default], @paths[:other]] }) end diff --git a/bridgetown-core/test/test_tags.rb b/bridgetown-core/test/test_tags.rb index af3db051f..8f8d169b8 100644 --- a/bridgetown-core/test/test_tags.rb +++ b/bridgetown-core/test/test_tags.rb @@ -167,7 +167,7 @@ def highlight_block_with_opts(options_string) ```liquid {% raw %} - {{ site.baseurl }}{% link _collection/name-of-document.md %} + {{ site.base_path }}{% link _collection/name-of-document.md %} {% endraw %} ``` CONTENT diff --git a/bridgetown-website/Gemfile b/bridgetown-website/Gemfile index 74ef7eb45..bf8a0d76e 100644 --- a/bridgetown-website/Gemfile +++ b/bridgetown-website/Gemfile @@ -10,10 +10,10 @@ gem "bridgetown-paginate", path: "../bridgetown-paginate" gem "puma", "< 7" -gem "bridgetown-feed", "~> 2.1", group: :bridgetown_plugins -gem "bridgetown-quick-search", "~> 1.1", group: :bridgetown_plugins -gem "bridgetown-seo-tag", "~> 5.0", group: :bridgetown_plugins -gem "bridgetown-svg-inliner", "~> 1.0", group: :bridgetown_plugins +gem "bridgetown-feed", "~> 3" +gem "bridgetown-quick-search", "~> 2.0" +gem "bridgetown-seo-tag", "~> 6.0" +gem "bridgetown-svg-inliner", "~> 2.0" gem "gems", "~> 1.2" gem "nokolexbor", "~> 0.4" diff --git a/bridgetown-website/Gemfile.lock b/bridgetown-website/Gemfile.lock index 504e338ab..a80964c8a 100644 --- a/bridgetown-website/Gemfile.lock +++ b/bridgetown-website/Gemfile.lock @@ -1,13 +1,13 @@ PATH remote: ../bridgetown-builder specs: - bridgetown-builder (1.3.3) - bridgetown-core (= 1.3.3) + bridgetown-builder (1.3.4) + bridgetown-core (= 1.3.4) PATH remote: ../bridgetown-core specs: - bridgetown-core (1.3.3) + bridgetown-core (1.3.4) activemodel (>= 6.0, < 8.0) activesupport (>= 6.0, < 8.0) addressable (~> 2.4) @@ -21,8 +21,9 @@ PATH i18n (~> 1.0) kramdown (~> 2.1) kramdown-parser-gfm (~> 1.0) - liquid (~> 5.0) + liquid (>= 5.0, < 5.5) listen (~> 3.0) + rack (>= 3.0) rake (>= 13.0) roda (~> 3.46) rouge (>= 3.0, < 5.0) @@ -34,16 +35,16 @@ PATH PATH remote: ../bridgetown-paginate specs: - bridgetown-paginate (1.3.3) - bridgetown-core (= 1.3.3) + bridgetown-paginate (1.3.4) + bridgetown-core (= 1.3.4) PATH remote: ../bridgetown specs: - bridgetown (1.3.3) - bridgetown-builder (= 1.3.3) - bridgetown-core (= 1.3.3) - bridgetown-paginate (= 1.3.3) + bridgetown (1.3.4) + bridgetown-builder (= 1.3.4) + bridgetown-core (= 1.3.4) + bridgetown-paginate (= 1.3.4) GEM remote: https://rubygems.org/ @@ -59,14 +60,14 @@ GEM public_suffix (>= 2.0.2, < 6.0) amazing_print (1.5.0) ast (2.4.2) - bridgetown-feed (2.1.0) - bridgetown (>= 1.0.0.alpha5, < 2.0) - bridgetown-quick-search (1.1.3) - bridgetown (>= 0.15.0.beta1, < 2.0) - bridgetown-seo-tag (5.0.0) - bridgetown (>= 0.20.0, < 2.0) - bridgetown-svg-inliner (1.1.0) - bridgetown (>= 1.0, < 2.0) + bridgetown-feed (3.1.2) + bridgetown (>= 1.2.0.beta2, < 2.0) + bridgetown-quick-search (2.0.0) + bridgetown (>= 1.2.0.beta2, < 2.0) + bridgetown-seo-tag (6.0.0) + bridgetown (>= 1.2.0.beta5, < 2.0) + bridgetown-svg-inliner (2.0.0) + bridgetown (>= 1.2.0, < 2.0) nokogiri colorator (1.1.0) concurrent-ruby (1.2.2) @@ -94,9 +95,9 @@ GEM rb-inotify (~> 0.9, >= 0.9.10) minitest (5.19.0) nio4r (2.7.0) - nokogiri (1.15.4-arm64-darwin) + nokogiri (1.16.3-arm64-darwin) racc (~> 1.4) - nokogiri (1.15.4-x86_64-linux) + nokogiri (1.16.3-x86_64-linux) racc (~> 1.4) nokolexbor (0.5.0-arm64-darwin) nokolexbor (0.5.0-x86_64-linux) @@ -139,11 +140,11 @@ DEPENDENCIES bridgetown! bridgetown-builder! bridgetown-core! - bridgetown-feed (~> 2.1) + bridgetown-feed (~> 3) bridgetown-paginate! - bridgetown-quick-search (~> 1.1) - bridgetown-seo-tag (~> 5.0) - bridgetown-svg-inliner (~> 1.0) + bridgetown-quick-search (~> 2.0) + bridgetown-seo-tag (~> 6.0) + bridgetown-svg-inliner (~> 2.0) gems (~> 1.2) nokolexbor (~> 0.4) puma (< 7) diff --git a/bridgetown-website/config/initializers.rb b/bridgetown-website/config/initializers.rb new file mode 100644 index 000000000..70bb997fe --- /dev/null +++ b/bridgetown-website/config/initializers.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +Bridgetown.configure do |_config| + init :"bridgetown-seo-tag" + init :"bridgetown-feed" + init :"bridgetown-quick-search" + init :"bridgetown-svg-inliner" +end diff --git a/bridgetown-website/package.json b/bridgetown-website/package.json index 16bae0799..c75f27d48 100644 --- a/bridgetown-website/package.json +++ b/bridgetown-website/package.json @@ -21,7 +21,7 @@ "@hotwired/turbo": "^7.1.0", "@ruby2js/esbuild-plugin": "^1.0.0", "@shoelace-style/shoelace": "^2.0.0-beta.82", - "bridgetown-quick-search": "1.1.3", + "bridgetown-quick-search": "2.0.0", "hotkeys-js": "^3.8.7", "smoothscroll-polyfill": "^0.4.4" }, diff --git a/bridgetown-website/server/roda_app.rb b/bridgetown-website/server/roda_app.rb index 8efa8a48f..921e63ebc 100644 --- a/bridgetown-website/server/roda_app.rb +++ b/bridgetown-website/server/roda_app.rb @@ -4,8 +4,8 @@ # # Learn more at: http://roda.jeremyevans.net -class RodaApp < Bridgetown::Rack::Roda - plugin :bridgetown_ssr +class RodaApp < Roda + plugin :bridgetown_server route do |r| r.bridgetown diff --git a/bridgetown-website/src/_docs/configuration/initializers.md b/bridgetown-website/src/_docs/configuration/initializers.md index f78105230..9324abfba 100644 --- a/bridgetown-website/src/_docs/configuration/initializers.md +++ b/bridgetown-website/src/_docs/configuration/initializers.md @@ -8,12 +8,6 @@ back_to: configuration In addition to setting some basic options in your [`bridgetown.config.yml` configuration file](/docs/configuration/options), you can use your site's `config/initializers.rb` file to set options, instantiate gem-based plugins, and write initializer blocks to configure third-party gems. -{%@ Note type: :warning do %} - #### Heads up: the `bridgetown_plugins` Bundler group has been deprecated - - In previous versions of Bridgetown, plugins were automatically required as long as they were added to the `bridgetown_plugins` group. We've changed that behavior in sites which feature a `config/initializers.rb` file. Now you can simply add gems to your `Gemfile` in any named or default group, and then load them into your codebase using `init`. -{% end %} - Here's a sample `config/initializers.rb` file showcasing many features of the configuration DSL: ```ruby diff --git a/bridgetown-website/src/_docs/plugins.md b/bridgetown-website/src/_docs/plugins.md index f86784774..0d3e0c146 100644 --- a/bridgetown-website/src/_docs/plugins.md +++ b/bridgetown-website/src/_docs/plugins.md @@ -46,10 +46,6 @@ bundle add bridgetown-feed bin/bridgetown apply https://github.com/bridgetownrb/bridgetown-cloudinary ``` -{%@ Note type: :warning do %} - Starting in Bridgetown 1.2, plugins are no longer required to be placed in the `bridgetown_plugins` group for sites which use the new initializers system. Read the [Initializers documentation](/docs/configuration/initializers/) for further details. -{% end %} - ## Introduction to the Builder API The Builder API (with its various DSLs) is typically the approach you'll use to write Bridgetown plugins. diff --git a/bridgetown-website/src/_posts/2022/2022-07-18-1.1-belmont-is-here.md b/bridgetown-website/src/_posts/2022/2022-07-18-1.1-belmont-is-here.md index 1900a8538..041f51ca2 100644 --- a/bridgetown-website/src/_posts/2022/2022-07-18-1.1-belmont-is-here.md +++ b/bridgetown-website/src/_posts/2022/2022-07-18-1.1-belmont-is-here.md @@ -34,7 +34,7 @@ Please visit our [Community page](/community) to learn how to submit feedback, r ### As Per Usual, More Changes are in Store… -In our "[Cherry Blossoms 2022 Edition](/future/whats-next-cherry-blossoms-edition/)" of what's coming next for Bridgetown, we talked about a few ecosystem additions and improvements coincidng with the release of Bridgetown 1.1 such as an ActiveRecord plugin. +In our "[Cherry Blossoms 2022 Edition](/future/whats-next-cherry-blossoms-edition/)" of what's coming next for Bridgetown, we talked about a few ecosystem additions and improvements coinciding with the release of Bridgetown 1.1 such as an ActiveRecord plugin. Well…it turns out that will have to wait for Bridgetown 1.2. diff --git a/bridgetown-website/src/_posts/2022/2022-10-10-1.2-bonny-scope-next-level.md b/bridgetown-website/src/_posts/2022/2022-10-10-1.2-bonny-scope-next-level.md index ef9d2769b..f2d574e84 100644 --- a/bridgetown-website/src/_posts/2022/2022-10-10-1.2-bonny-scope-next-level.md +++ b/bridgetown-website/src/_posts/2022/2022-10-10-1.2-bonny-scope-next-level.md @@ -16,7 +16,7 @@ Most frameworks have some sort of initialization or boot up sequence. They typic Bridgetown, curiously, has not offered an initialization sequence that's "open to the public". We just did stuff, as if by magic. Some magic in programming is good, but when it comes to how your application starts up and first runs, we'd prefer to err on the side of explicit determinism. If you want A, B, C, D, and E to happen—in that order— and only D should happen in this context, and only E should happen in some other context—then by golly you should be able to specify that in your code. (If you're curious, [there's a whole podcast about this singular topic](https://www.fullstackruby.dev/podcast/6/) on Fullstack Ruby.) -To date, Bridgetown's configuration format has been a single YAML file. You can set some options and…that's it. Fine for simple projects, but after a while this starts to feel rather limiting. You could also add some Ruby code to your `plugins/site_builder.rb` file to set up a gem and whatnot, but honestly that file was never designed expressly for placing arbitrary "run this once and only once" boot code. In addition, we've had a long-running convention that placing certain gems in a certain Gemfile group (`bridgetown_plugins`) would mean that they are automatically loaded by Bridgetown during initialization. But this convention means you'd never really know what is loading when, and it doesn't provide any code-level mechanism for attaching configuration options to that plugin. And more recently, our integration with the Roda web toolkit means we have to accomodate Roda plugins as well, which are traditionally loaded and configured in their own unique way. +To date, Bridgetown's configuration format has been a single YAML file. You can set some options and…that's it. Fine for simple projects, but after a while this starts to feel rather limiting. You could also add some Ruby code to your `plugins/site_builder.rb` file to set up a gem and whatnot, but honestly that file was never designed expressly for placing arbitrary "run this once and only once" boot code. In addition, we've had a long-running convention that placing certain gems in a certain Gemfile group (`bridgetown_plugins`) would mean that they are automatically loaded by Bridgetown during initialization. But this convention means you'd never really know what is loading when, and it doesn't provide any code-level mechanism for attaching configuration options to that plugin. And more recently, our integration with the Roda web toolkit means we have to accommodate Roda plugins as well, which are traditionally loaded and configured in their own unique way. ### Customize All the Things, Now in Ruby 😎 diff --git a/bridgetown-website/yarn.lock b/bridgetown-website/yarn.lock index 2b73e40f8..f7a6d24ed 100644 --- a/bridgetown-website/yarn.lock +++ b/bridgetown-website/yarn.lock @@ -464,10 +464,10 @@ braces@^3.0.2: dependencies: fill-range "^7.0.1" -bridgetown-quick-search@1.1.3: - version "1.1.3" - resolved "https://registry.npmmirror.com/bridgetown-quick-search/-/bridgetown-quick-search-1.1.3.tgz#a54985723d7febafc3b74d6bccb0f5f91e282f29" - integrity sha512-KsRvW3LpLr90YRm/c5z05/dQABSav4haQ2hzHPxc9eixQ6FQVCFVFvHnWhh/WdpBzpgTUG6HiLJHP7oPA7JAfg== +bridgetown-quick-search@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/bridgetown-quick-search/-/bridgetown-quick-search-2.0.0.tgz#c3a999590341bef5f87e57bcec67b5b45db21e54" + integrity sha512-Sr8RS0qu+a9o4dDbRyaDGEcVEWphuuhcZUnqqgL6EghDncE4QiocGB8xem6mPdT+gWAw22O5BznqH3DCb1WI+Q== dependencies: "@babel/runtime" "^7.10.1" lit "^2.0.0"