Skip to content

Commit

Permalink
Remove automatic propagation of generators options
Browse files Browse the repository at this point in the history
By removing the override of the `generate` method in this
generator, we stop propagating those custom arguments to
all the inner generators called by the installer.

For example, at the moment, the installer is running

	rails    generate rspec:install --auto-accept --auto-run-migrations

see [1], which doesn't make sense and might also have
unexpected behaviors if we (or any dependency) run a generator
during their installation, which accepts those arguments.

Instead of always propaging these option, we are explicitely
declaring them when needed.

[1]: solidusio/solidus_starter_frontend#295

Co-authored-by: safafa <[email protected]>
  • Loading branch information
kennyadsl and safafa committed Apr 14, 2023
1 parent fd277b0 commit 0e75344
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
bundle_command 'add solidus_bolt'
end

generate 'solidus_bolt:install'
generate 'solidus_bolt:install' "--auto_run_migrations=#{options[:migrate]}"
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
bundle_command 'add solidus_braintree --version "~> 3.0"'
end

generate 'solidus_braintree:install'
generate 'solidus_braintree:install' "--migrate=#{options[:migrate]}"
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
bundle_command "add solidus_paypal_commerce_platform --version='#{version}'"
end

generate 'solidus_paypal_commerce_platform:install'
generate 'solidus_paypal_commerce_platform:install' "--migrate=#{options[:migrate]}"
6 changes: 0 additions & 6 deletions core/lib/generators/solidus/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down

0 comments on commit 0e75344

Please sign in to comment.