From e149611066fa6680ed72bf4b6d2c4c2b6fd59215 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Mon, 14 Feb 2022 15:03:32 -0800 Subject: [PATCH] Use Rails.version to get actual rails version --- lib/engine_cart/tasks/engine_cart.rake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/engine_cart/tasks/engine_cart.rake b/lib/engine_cart/tasks/engine_cart.rake index 03fd4e2..a5972d7 100644 --- a/lib/engine_cart/tasks/engine_cart.rake +++ b/lib/engine_cart/tasks/engine_cart.rake @@ -27,6 +27,8 @@ namespace :engine_cart do task :create_test_rails_app => [:setup] do require 'tmpdir' require 'fileutils' + require 'rails/version' + Dir.mktmpdir do |dir| # Fork into a new process to avoid polluting the current one with the partial Rails environment ... pid = fork do @@ -66,7 +68,7 @@ namespace :engine_cart do Rake::Task['engine_cart:clean'].invoke if File.exist? EngineCart.destination FileUtils.move "#{dir}/internal", "#{EngineCart.destination}" - if Gem.loaded_specs['rails'].version.to_s < '5.2.3' + if Rails.version < '5.2.3' # Hack for https://github.com/rails/rails/issues/35153 gemfile = File.join(EngineCart.destination, 'Gemfile') IO.write(gemfile, File.open(gemfile) do |f|