Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport SolidusPaypalBraintree rename and earlier changes to v1.x #128

Closed
wants to merge 820 commits into from

Conversation

gsmendoza
Copy link
Contributor

@gsmendoza gsmendoza commented Mar 14, 2023

Summary

Closes #127.

This PR would fast-forward https://github.com/solidusio/solidus_braintree/tree/v1.x up to and before #102. (To fix the CI, I cherry-picked the RuboCop offense fixes cb82bfe and 838c025.)

This is in preparation for releasing the last 1.x version for SolidusBraintree: v1.3.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

kennyadsl and others added 30 commits February 2, 2019 01:15
* Add Solidus v2.8
* Remove Solidus v2.3
FactoryBot v5.0 defaults `use_parent_strategy` to true, which builds
(rather than create) associations, which was causing several specs
to fail.
SQLite3 v1.4 was released on February 4th, which breaks compatibility
with ActiveRecord's adapter for said DB engine.
Add byebug as a development dependency for debugging during development
and testing.
Add association on the spree user model to associate it with the
braintree customer model.
This moves the solidus dependency imports to only directly import
solidus_core and solidus_api through the gemspec.
Closes #222. It adds an `id` local variable to `spree/shared/apple_pay_button` partial rendering in order to give such partial access to the payment method id.
Closes #224. On default Braintree configuration building we need to
check whether a configuration already exists, so the prevent the
overwrite of such configuration.
Fix undefined local variable or method `id' error
…onfiguration-presence-on-store-creation

Skip building default config on config presence
…ustomer

Add association from user to customer
elia and others added 23 commits December 6, 2022 19:27
Make it match the defaults coming from dev-support.
Also normalizes a few things to better match the defaults coming from
dev-support.
Update to the latest dev-support defaults
…al-braintree

Merge the history of Solidus PayPal Braintree into this repository
Using model classes local to the migration is a technique that allows
accessing the underlying tables through AR without a dependency of the
app models being available across time. This is supported by rails
that explicitly sets the table_name_prefix of migration classes to be
an empty string.

In this specific case, for example, `SpreePayment.table_name` will be
`spree_payments`, which is the same as `Spree::Payment.table_name`.

If Spree::Payment will change name and become, say, Solidus::Payment,
this migration won't break a sweat and will keep working.

This way any change in table names or prefixes, or even removing a
model altogether won't affect older migrations.
…migrations

Make migrations independent of existing models
… braintree

Do not include migration files. If renamed, `bin/rails
railties:install:migrations` would interpret the migrations as new
migrations for SolidusBraintree.
* Exclude CHANGELOG.
* Exclude DB migration classes since they have to match their file
  names.
Exclude CHANGELOG and database table names.
Can be used by passing `require: 'solidus_paypal_braintree`
directive to `gem 'solidus_braintree'` in Gemfile.
Fixes the following offenses:

```
solidus_braintree 17:53:08 $ bundle exec rubocop lib/generators/solidus_braintree/install/install_generator.rb
Inspecting 1 file
C

Offenses:

lib/generators/solidus_braintree/install/install_generator.rb:19:121: C: [Correctable] Layout/LineLength: Line is too long. [157/120]
        inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/solidus_braintree\n", before: %r{\*/}, verbose: true
                                                                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/generators/solidus_braintree/install/install_generator.rb:20:121: C: [Correctable] Layout/LineLength: Line is too long. [155/120]
        inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/solidus_braintree\n", before: %r{\*/}, verbose: true
                                                                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/generators/solidus_braintree/install/install_generator.rb:32:121: C: [Correctable] Layout/LineLength: Line is too long. [137/120]
        run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
                                                                                                                        ^^^^^^^^^^^^^^^^^

1 file inspected, 3 offenses detected, 3 offenses autocorrectable
```
* Renames engine route and asset file paths.
* Adds migration to update records referring to SolidusPaypalBraintree.
…on-namespace-to-solidus-braintree

Update the SolidusPaypalBraintree namespace to SolidusBraintree
@gsmendoza gsmendoza requested a review from kennyadsl March 14, 2023 03:25
@gsmendoza gsmendoza self-assigned this Mar 14, 2023
Offenses:

app/models/solidus_braintree/transaction.rb:20:21: C: [Correctable] Style/InverseMethods: Use invalid? instead of inverting valid?.
      if address && !address.valid?
                    ^^^^^^^^^^^^^^^
app/models/solidus_braintree/transaction_import.rb:12:57: C: [Correctable] Style/InverseMethods: Use invalid? instead of inverting valid?.
      errors.add("Address", "is invalid") if address && !address.valid?
                                                        ^^^^^^^^^^^^^^^
app/models/solidus_braintree/transaction_import.rb:14:10: C: [Correctable] Style/InverseMethods: Use invalid? instead of inverting valid?.
      if !transaction.valid?
         ^^^^^^^^^^^^^^^^^^^
Offenses:

app/models/solidus_braintree/transaction.rb:20:10: C: [Correctable] Style/SafeNavigation: Use safe navigation (&.) instead of checking if an object exists before calling the method.
      if address && address.invalid?
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/solidus_braintree/transaction_import.rb:12:46: C: [Correctable] Style/SafeNavigation: Use safe navigation (&.) instead of checking if an object exists before calling the method.
      errors.add("Address", "is invalid") if address && address.invalid?
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@gsmendoza
Copy link
Contributor Author

Closing. As discussed offline, we don't want to include the name change in the 1.x line of the extension since it's a major breaking change.

@gsmendoza gsmendoza closed this Mar 14, 2023
@kennyadsl kennyadsl deleted the gsmendoza/127-backport-master-to-1-x branch March 20, 2023 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.