From 472a99355d80f7fc17747eea73eec5f4614c5874 Mon Sep 17 00:00:00 2001 From: Jared White Date: Wed, 20 Oct 2021 15:58:47 -0700 Subject: [PATCH] Backport Zeitwerk fix to 0.21 --- .../lib/bridgetown-core/plugin_manager.rb | 14 ++++++++------ bridgetown-core/lib/bridgetown-core/version.rb | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/bridgetown-core/lib/bridgetown-core/plugin_manager.rb b/bridgetown-core/lib/bridgetown-core/plugin_manager.rb index c45a6106d..1c1abde63 100644 --- a/bridgetown-core/lib/bridgetown-core/plugin_manager.rb +++ b/bridgetown-core/lib/bridgetown-core/plugin_manager.rb @@ -173,13 +173,15 @@ def setup_component_loaders # source components _before_ we load any from plugins site.components_load_paths.reverse_each do |load_path| next unless Dir.exist? load_path - next if Zeitwerk::Registry.loaders.find { |loader| loader.manages?(load_path) } - @component_loaders[load_path] = Zeitwerk::Loader.new - @component_loaders[load_path].push_dir(load_path) - @component_loaders[load_path].enable_reloading if load_path.start_with?(site.root_dir) - @component_loaders[load_path].ignore(File.join(load_path, "**", "*.js.rb")) - @component_loaders[load_path].setup + begin + @component_loaders[load_path] = Zeitwerk::Loader.new + @component_loaders[load_path].push_dir(load_path) + @component_loaders[load_path].enable_reloading if load_path.start_with?(site.root_dir) + @component_loaders[load_path].ignore(File.join(load_path, "**", "*.js.rb")) + @component_loaders[load_path].setup + rescue Zeitwerk::Error # rubocop:disable Lint/SuppressedException + end end end # rubocop:enable Metrics/AbcSize diff --git a/bridgetown-core/lib/bridgetown-core/version.rb b/bridgetown-core/lib/bridgetown-core/version.rb index 092bd9dd3..735ec544c 100644 --- a/bridgetown-core/lib/bridgetown-core/version.rb +++ b/bridgetown-core/lib/bridgetown-core/version.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module Bridgetown - VERSION = "0.21.4" + VERSION = "0.21.5" CODE_NAME = "Broughton Beach" end