diff --git a/core/lib/generators/solidus/install/app_templates/payment_method/bolt.rb b/core/lib/generators/solidus/install/app_templates/payment_method/bolt.rb index fdb6d602fec..dfd96a3c913 100644 --- a/core/lib/generators/solidus/install/app_templates/payment_method/bolt.rb +++ b/core/lib/generators/solidus/install/app_templates/payment_method/bolt.rb @@ -10,4 +10,4 @@ bundle_command 'add solidus_bolt' end -generate 'solidus_bolt:install' +generate "solidus_bolt:install --auto-run-migrations=#{options[:migrate]}" diff --git a/core/lib/generators/solidus/install/app_templates/payment_method/braintree.rb b/core/lib/generators/solidus/install/app_templates/payment_method/braintree.rb index a3bebb93132..7d6b29c891d 100644 --- a/core/lib/generators/solidus/install/app_templates/payment_method/braintree.rb +++ b/core/lib/generators/solidus/install/app_templates/payment_method/braintree.rb @@ -2,4 +2,4 @@ bundle_command 'add solidus_braintree --version "~> 3.0"' end -generate 'solidus_braintree:install' +generate "solidus_braintree:install --migrate=#{options[:migrate]}" diff --git a/core/lib/generators/solidus/install/app_templates/payment_method/paypal.rb b/core/lib/generators/solidus/install/app_templates/payment_method/paypal.rb index faf2952b32a..8b0aaf6ab36 100644 --- a/core/lib/generators/solidus/install/app_templates/payment_method/paypal.rb +++ b/core/lib/generators/solidus/install/app_templates/payment_method/paypal.rb @@ -2,9 +2,16 @@ say_status :warning, "Support for frontends other than `solidus_frontend` by `solidus_paypal_commerce_platform` is still in progress.", :yellow end +if @selected_frontend == 'classic' + version = '< 1' + migrations_flag = options[:migrate] ? '--auto-run-migrations' : '--skip-migrations' +else + version = '~> 1.0' + migrations_flag = "--migrate=#{options[:migrate]}" +end + unless Bundler.locked_gems.dependencies['solidus_paypal_commerce_platform'] - version = @selected_frontend == 'classic' ? '< 1' : '~> 1.0' bundle_command "add solidus_paypal_commerce_platform --version='#{version}'" end -generate 'solidus_paypal_commerce_platform:install' +generate "solidus_paypal_commerce_platform:install #{migrations_flag}" diff --git a/core/lib/generators/solidus/install/install_generator.rb b/core/lib/generators/solidus/install/install_generator.rb index fb82b5edb8f..7d6d3f14a1d 100644 --- a/core/lib/generators/solidus/install/install_generator.rb +++ b/core/lib/generators/solidus/install/install_generator.rb @@ -222,12 +222,6 @@ def complete private - def generate(what, *args, abort_on_failure: true) - args << '--auto-accept' if options[:auto_accept] - args << '--auto-run-migrations' if options[:migrate] - super(what, *args, abort_on_failure: abort_on_failure) - end - def bundle_command(command, env = {}) # Make `bundle install` less verbose by skipping the "Using ..." messages super(command, env.reverse_merge('BUNDLE_SUPPRESS_INSTALL_USING_MESSAGES' => 'true'))