From fbb7146ef24d9e64485afda73d65e7110fb0d151 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Thu, 11 Aug 2022 10:49:21 +0200 Subject: [PATCH] Fix Bootsnap.unload_cache! Fix: #421 It was broken because of some stupid rebase mistakes... --- CHANGELOG.md | 2 ++ lib/bootsnap.rb | 2 +- lib/bootsnap/load_path_cache.rb | 1 - test/setup_test.rb | 4 ++++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64649f7f..ef67ad73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Unreleased +* Fix `Bootsnap.unload_cache!`, it simply wouldn't work at all becaue of a merge mistake. See #421. + # 1.13.0 * Stop decorating `Kernel.load`. This used to be very useful in development because the Rails "classic" autoloader diff --git a/lib/bootsnap.rb b/lib/bootsnap.rb index d5490f3a..fa7d2d07 100644 --- a/lib/bootsnap.rb +++ b/lib/bootsnap.rb @@ -76,7 +76,7 @@ def setup( ) end - def self.unload_cache! + def unload_cache! LoadPathCache.unload! end diff --git a/lib/bootsnap/load_path_cache.rb b/lib/bootsnap/load_path_cache.rb index 30ced18f..0cd977ba 100644 --- a/lib/bootsnap/load_path_cache.rb +++ b/lib/bootsnap/load_path_cache.rb @@ -50,7 +50,6 @@ def unload! @realpath_cache = nil @load_path_cache = nil ChangeObserver.unregister($LOAD_PATH) - ::Kernel.alias_method(:require_relative, :require_relative_without_bootsnap) end def supported? diff --git a/test/setup_test.rb b/test/setup_test.rb index a118907f..312bd943 100644 --- a/test/setup_test.rb +++ b/test/setup_test.rb @@ -94,5 +94,9 @@ def test_default_setup_with_BOOTSNAP_LOG Bootsnap.default_setup end + + def test_unload_cache + Bootsnap.unload_cache! + end end end