From d800b868def948b26fe3a0ca08959aaed535c293 Mon Sep 17 00:00:00 2001 From: George Mendoza Date: Thu, 1 Dec 2022 15:09:46 +0800 Subject: [PATCH] Replace bundle_cleanly with AppBase methods Recommended in https://github.com/solidusio/solidus/pull/4748/files#r1034594589. See https://api.rubyonrails.org/v3.2.16/classes/Rails/Generators/AppBase.html. --- .../solidus/install/install_generator.rb | 2 +- .../install_generator/install_frontend.rb | 17 +++-------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/core/lib/generators/solidus/install/install_generator.rb b/core/lib/generators/solidus/install/install_generator.rb index 88bd3311e2d..bafaa042d7e 100644 --- a/core/lib/generators/solidus/install/install_generator.rb +++ b/core/lib/generators/solidus/install/install_generator.rb @@ -302,7 +302,7 @@ def install_plugin(plugin_name:, plugin_generator_name:) end gem plugin_name - BundlerContext.bundle_cleanly { run "bundle install" } + run_bundle run "spring stop" if defined?(Spring) generate "#{plugin_generator_name} --skip_migrations=true" end diff --git a/core/lib/generators/solidus/install/install_generator/install_frontend.rb b/core/lib/generators/solidus/install/install_generator/install_frontend.rb index c5e88b4a8a8..ad41e3228a9 100644 --- a/core/lib/generators/solidus/install/install_generator/install_frontend.rb +++ b/core/lib/generators/solidus/install/install_generator/install_frontend.rb @@ -24,22 +24,11 @@ def call(frontend) private - def bundle_command(command) - @generator_context.say_status :run, "bundle #{command}" - bundle_path = Gem.bin_path("bundler", "bundle") - - BundlerContext.bundle_cleanly do - system( - Gem.ruby, - bundle_path, - *command.shellsplit, - ) - end - end - def install_solidus_frontend unless @bundler_context.component_in_gemfile?(:frontend) - bundle_command 'add solidus_frontend' + # `Rails::Generator::AppBase#bundle_command` is protected so have to `send` it. + # See https://api.rubyonrails.org/v3.2.16/classes/Rails/Generators/AppBase.html#method-i-run_bundle + @generator_context.send :bundle_command, 'add solidus_frontend' end # Solidus bolt will be handled in the installer as a payment method.