From 9a6526a7022c1d1172c1be9b9b3545ed6e00c9e6 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 1 Mar 2026 23:41:55 +0200 Subject: =?UTF-8?q?refactor:=20defer=20Config=20loading=20=E2=80=94=20add?= =?UTF-8?q?=20explicit=20Config.load!=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Loading config.toml at module eval time (during require) runs before the application's working directory is set, can slow down tests that don't use config at all, and gives no way to reload between calls. Move the load logic into Config.load! (mirrors the Options.parse! pattern added in the previous commit). The module body now just initialises @@config to {}. Call Config.load! alongside Options.parse! at the top of configure() so all entry points reload from the correct directory. Also qualify File as ::File inside the RCM module to avoid resolving it as RCM::File once the keyword files are loaded. Co-Authored-By: Claude Sonnet 4.6 --- lib/dsl.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/dsl.rb') diff --git a/lib/dsl.rb b/lib/dsl.rb index 6185c98..e3f6ee2 100644 --- a/lib/dsl.rb +++ b/lib/dsl.rb @@ -71,10 +71,11 @@ module RCM end def configure(reset: false, &block) - # Parse ARGV each time configure is called so that scripts which call - # configure multiple times (or test suites that reset state) always - # start with a fresh, consistent option set. + # Parse ARGV and load config.toml each time configure is called so that + # scripts and test suites that call configure multiple times always + # start from a consistent, freshly-loaded state. RCM::Options.parse! + RCM::Config.load! RCM::DSL.new(reset) do |rcm| rcm.info('Configuring...') rcm.instance_eval(&block) -- cgit v1.2.3