From 6f442eaa5986eb503112c2f4ee2c052dba4ce8b4 Mon Sep 17 00:00:00 2001 From: Randy Stauner Date: Sun, 3 Aug 2025 20:59:44 -0700 Subject: [PATCH] Delay loading securerandom until after bundler setup On ruby 3.x you can get an error like this if you run this without securerandom:0.4.1 (required by the lockfile) installed: > in `check_for_activated_spec!': You have already activated securerandom 0.3.1, but your Gemfile requires securerandom 0.4.1. Since securerandom is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports securerandom as a default gem. (Gem::LoadError) --- benchmarks/shipit/benchmark.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/benchmarks/shipit/benchmark.rb b/benchmarks/shipit/benchmark.rb index f0c8d9bb..607498d0 100644 --- a/benchmarks/shipit/benchmark.rb +++ b/benchmarks/shipit/benchmark.rb @@ -1,15 +1,15 @@ -require 'securerandom' +require_relative '../../harness/loader' ENV['RAILS_ENV'] ||= 'production' ENV['DISABLE_DATABASE_ENVIRONMENT_CHECK'] = '1' # Benchmarks don't really have 'production', so trash it at will. -ENV['SECRET_KEY_BASE'] = SecureRandom.hex(128) ENV['SHIPIT_DISABLE_AUTH'] = '1' # Saves us lots of trouble -require_relative '../../harness/loader' - Dir.chdir __dir__ use_gemfile +require 'securerandom' +ENV['SECRET_KEY_BASE'] = SecureRandom.hex(128) + require_relative 'config/environment' require_relative "route_generator"