solidus_core 3.0.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of solidus_core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/helpers/spree/base_helper.rb +1 -1
- data/app/helpers/spree/products_helper.rb +1 -1
- data/app/models/concerns/spree/default_price.rb +63 -10
- data/app/models/spree/adjustment.rb +6 -5
- data/app/models/spree/customer_return.rb +3 -2
- data/app/models/spree/image/active_storage_attachment.rb +2 -7
- data/app/models/spree/image/paperclip_attachment.rb +2 -2
- data/app/models/spree/line_item.rb +2 -2
- data/app/models/spree/order.rb +11 -6
- data/app/models/spree/price.rb +1 -1
- data/app/models/spree/product/scopes.rb +5 -5
- data/app/models/spree/product.rb +12 -0
- data/app/models/spree/promotion/rules/item_total.rb +50 -6
- data/app/models/spree/promotion.rb +2 -2
- data/app/models/spree/promotion_code.rb +1 -1
- data/app/models/spree/shipping_rate_tax.rb +1 -1
- data/app/models/spree/stock/availability.rb +11 -3
- data/app/models/spree/stock/simple_coordinator.rb +0 -10
- data/app/models/spree/stock_location.rb +1 -1
- data/app/models/spree/store_credit.rb +6 -1
- data/app/models/spree/tax_calculator/shipping_rate.rb +1 -1
- data/app/models/spree/taxon/active_storage_attachment.rb +2 -2
- data/app/models/spree/taxon/paperclip_attachment.rb +3 -3
- data/app/models/spree/variant/price_selector.rb +16 -3
- data/app/models/spree/variant.rb +26 -16
- data/config/locales/en.yml +2 -0
- data/db/migrate/20210312061050_change_column_null_on_prices.rb +7 -0
- data/lib/generators/solidus/install/install_generator.rb +1 -1
- data/lib/generators/solidus/install/templates/config/initializers/spree.rb.tt +3 -1
- data/lib/generators/solidus/update/templates/config/initializers/new_solidus_defaults.rb.tt +30 -0
- data/lib/generators/solidus/update/update_generator.rb +112 -0
- data/lib/generators/spree/dummy/templates/rails/application.rb.tt +0 -1
- data/lib/generators/spree/dummy/templates/rails/database.yml +78 -35
- data/lib/spree/app_configuration.rb +62 -0
- data/lib/spree/core/engine.rb +10 -11
- data/lib/spree/core/product_filters.rb +1 -1
- data/lib/spree/core/search/base.rb +1 -1
- data/lib/spree/core/state_machines/order.rb +1 -1
- data/lib/spree/core/version.rb +5 -1
- data/lib/spree/core/versioned_value.rb +75 -0
- data/lib/spree/core.rb +17 -0
- data/lib/spree/permitted_attributes.rb +1 -1
- data/lib/spree/preferences/configuration.rb +62 -0
- data/lib/spree/preferences/preferable.rb +8 -0
- data/lib/spree/preferences/preferable_class_methods.rb +5 -3
- data/lib/spree/preferences/preference_differentiator.rb +28 -0
- data/lib/spree/testing_support/dummy_app/database.yml +42 -22
- data/lib/spree/testing_support/dummy_app.rb +33 -18
- data/lib/tasks/solidus/delete_prices_with_nil_amount.rake +8 -0
- metadata +7 -3
- data/app/models/spree/tax/shipping_rate_taxer.rb +0 -24
- data/lib/tasks/upgrade.rake +0 -15
| @@ -46,35 +46,53 @@ module DummyApp | |
| 46 46 | 
             
              end
         | 
| 47 47 |  | 
| 48 48 | 
             
              class Application < ::Rails::Application
         | 
| 49 | 
            -
                config. | 
| 50 | 
            -
                 | 
| 49 | 
            +
                config.load_defaults("#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}")
         | 
| 50 | 
            +
                # Make the test environment more production-like:
         | 
| 51 51 | 
             
                config.cache_classes = true
         | 
| 52 | 
            -
                config.cache_store = :memory_store
         | 
| 53 | 
            -
                config.serve_static_assets = true
         | 
| 54 | 
            -
                config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
         | 
| 55 | 
            -
                config.whiny_nils = true
         | 
| 56 | 
            -
                config.consider_all_requests_local = true
         | 
| 57 52 | 
             
                config.action_controller.allow_forgery_protection = false
         | 
| 58 53 | 
             
                config.action_controller.default_protect_from_forgery = false
         | 
| 54 | 
            +
                config.action_mailer.perform_caching = false
         | 
| 55 | 
            +
                config.i18n.fallbacks = true
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                # In the test environment, we use the `caching: true` RSpec metadata to
         | 
| 58 | 
            +
                # enable caching on select specs. See
         | 
| 59 | 
            +
                # core/lib/spree/testing_support/caching.rb. See also
         | 
| 60 | 
            +
                # https://github.com/solidusio/solidus/issues/4110
         | 
| 59 61 | 
             
                config.action_controller.perform_caching = false
         | 
| 62 | 
            +
             | 
| 63 | 
            +
                # Make debugging easier:
         | 
| 64 | 
            +
                config.consider_all_requests_local = true
         | 
| 60 65 | 
             
                config.action_dispatch.show_exceptions = false
         | 
| 61 66 | 
             
                config.active_support.deprecation = :stderr
         | 
| 67 | 
            +
                config.log_level = :debug
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                # Improve test suite performance:
         | 
| 70 | 
            +
                config.eager_load = false
         | 
| 71 | 
            +
                config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
         | 
| 72 | 
            +
                config.cache_store = :memory_store
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                # We don't use a web server, so we let Rails serve assets.
         | 
| 75 | 
            +
                config.public_file_server.enabled = true
         | 
| 76 | 
            +
             | 
| 77 | 
            +
                # We don't want to send email in the test environment.
         | 
| 62 78 | 
             
                config.action_mailer.delivery_method = :test
         | 
| 63 | 
            -
             | 
| 79 | 
            +
             | 
| 80 | 
            +
                # No need to use credentials file in a test environment.
         | 
| 64 81 | 
             
                config.secret_key_base = 'SECRET_TOKEN'
         | 
| 65 82 |  | 
| 66 | 
            -
                 | 
| 83 | 
            +
                # Set the preview path within the dummy app:
         | 
| 67 84 | 
             
                config.action_mailer.preview_path = File.expand_path('dummy_app/mailer_previews', __dir__)
         | 
| 68 | 
            -
                config.active_record.sqlite3.represent_boolean_as_integer = true unless RAILS_6_OR_ABOVE
         | 
| 69 85 |  | 
| 70 | 
            -
                config. | 
| 86 | 
            +
                config.active_record.sqlite3.represent_boolean_as_integer = true unless RAILS_6_OR_ABOVE
         | 
| 87 | 
            +
                config.active_record.dump_schema_after_migration = false
         | 
| 71 88 |  | 
| 89 | 
            +
                # Configure active storage to use storage within tmp folder
         | 
| 72 90 | 
             
                unless ENV['DISABLE_ACTIVE_STORAGE']
         | 
| 73 91 | 
             
                  initializer 'solidus.active_storage' do
         | 
| 74 92 | 
             
                    config.active_storage.service_configurations = {
         | 
| 75 93 | 
             
                      test: {
         | 
| 76 94 | 
             
                        service: 'Disk',
         | 
| 77 | 
            -
                        root:  | 
| 95 | 
            +
                        root: Rails.root.join('tmp', 'storage')
         | 
| 78 96 | 
             
                      }
         | 
| 79 97 | 
             
                    }
         | 
| 80 98 | 
             
                    config.active_storage.service = :test
         | 
| @@ -95,12 +113,8 @@ module DummyApp | |
| 95 113 | 
             
                config.paths['db/migrate'] = migration_dirs
         | 
| 96 114 | 
             
                ActiveRecord::Migrator.migrations_paths = migration_dirs
         | 
| 97 115 |  | 
| 98 | 
            -
                config. | 
| 99 | 
            -
             | 
| 100 | 
            -
                if config.respond_to?(:assets)
         | 
| 101 | 
            -
                  config.assets.paths << File.expand_path('dummy_app/assets/javascripts', __dir__)
         | 
| 102 | 
            -
                  config.assets.paths << File.expand_path('dummy_app/assets/stylesheets', __dir__)
         | 
| 103 | 
            -
                end
         | 
| 116 | 
            +
                config.assets.paths << File.expand_path('dummy_app/assets/javascripts', __dir__)
         | 
| 117 | 
            +
                config.assets.paths << File.expand_path('dummy_app/assets/stylesheets', __dir__)
         | 
| 104 118 |  | 
| 105 119 | 
             
                config.paths["config/database"] = File.expand_path('dummy_app/database.yml', __dir__)
         | 
| 106 120 | 
             
                config.paths['app/views'] = File.expand_path('dummy_app/views', __dir__)
         | 
| @@ -117,6 +131,7 @@ ActiveSupport.on_load(:action_controller) do | |
| 117 131 | 
             
            end
         | 
| 118 132 |  | 
| 119 133 | 
             
            Spree.user_class = 'Spree::LegacyUser'
         | 
| 134 | 
            +
            Spree.load_defaults(Spree.solidus_version)
         | 
| 120 135 | 
             
            Spree.config do |config|
         | 
| 121 136 | 
             
              config.mails_from = "store@example.com"
         | 
| 122 137 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: solidus_core
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 3.0 | 
| 4 | 
            +
              version: 3.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Solidus Team
         | 
| @@ -609,7 +609,6 @@ files: | |
| 609 609 | 
             
            - app/models/spree/tax/item_tax.rb
         | 
| 610 610 | 
             
            - app/models/spree/tax/order_adjuster.rb
         | 
| 611 611 | 
             
            - app/models/spree/tax/order_tax.rb
         | 
| 612 | 
            -
            - app/models/spree/tax/shipping_rate_taxer.rb
         | 
| 613 612 | 
             
            - app/models/spree/tax/tax_helpers.rb
         | 
| 614 613 | 
             
            - app/models/spree/tax/tax_location.rb
         | 
| 615 614 | 
             
            - app/models/spree/tax_calculator/default.rb
         | 
| @@ -705,6 +704,7 @@ files: | |
| 705 704 | 
             
            - db/migrate/20200530111458_add_bcc_email_to_spree_stores.rb
         | 
| 706 705 | 
             
            - db/migrate/20201008213609_add_discontinue_on_to_spree_products.rb
         | 
| 707 706 | 
             
            - db/migrate/20210122110141_add_name_to_spree_addresses.rb
         | 
| 707 | 
            +
            - db/migrate/20210312061050_change_column_null_on_prices.rb
         | 
| 708 708 | 
             
            - db/seeds.rb
         | 
| 709 709 | 
             
            - lib/generators/solidus/install/install_generator.rb
         | 
| 710 710 | 
             
            - lib/generators/solidus/install/templates/config/initializers/spree.rb.tt
         | 
| @@ -712,6 +712,8 @@ files: | |
| 712 712 | 
             
            - lib/generators/solidus/install/templates/vendor/assets/javascripts/spree/frontend/all.js
         | 
| 713 713 | 
             
            - lib/generators/solidus/install/templates/vendor/assets/stylesheets/spree/backend/all.css
         | 
| 714 714 | 
             
            - lib/generators/solidus/install/templates/vendor/assets/stylesheets/spree/frontend/all.css
         | 
| 715 | 
            +
            - lib/generators/solidus/update/templates/config/initializers/new_solidus_defaults.rb.tt
         | 
| 716 | 
            +
            - lib/generators/solidus/update/update_generator.rb
         | 
| 715 717 | 
             
            - lib/generators/spree/custom_user/custom_user_generator.rb
         | 
| 716 718 | 
             
            - lib/generators/spree/custom_user/templates/authentication_helpers.rb.tt
         | 
| 717 719 | 
             
            - lib/generators/spree/custom_user/templates/migration.rb.tt
         | 
| @@ -765,6 +767,7 @@ files: | |
| 765 767 | 
             
            - lib/spree/core/stock_configuration.rb
         | 
| 766 768 | 
             
            - lib/spree/core/validators/email.rb
         | 
| 767 769 | 
             
            - lib/spree/core/version.rb
         | 
| 770 | 
            +
            - lib/spree/core/versioned_value.rb
         | 
| 768 771 | 
             
            - lib/spree/deprecation.rb
         | 
| 769 772 | 
             
            - lib/spree/encryptor.rb
         | 
| 770 773 | 
             
            - lib/spree/event.rb
         | 
| @@ -804,6 +807,7 @@ files: | |
| 804 807 | 
             
            - lib/spree/preferences/persistable.rb
         | 
| 805 808 | 
             
            - lib/spree/preferences/preferable.rb
         | 
| 806 809 | 
             
            - lib/spree/preferences/preferable_class_methods.rb
         | 
| 810 | 
            +
            - lib/spree/preferences/preference_differentiator.rb
         | 
| 807 811 | 
             
            - lib/spree/preferences/scoped_store.rb
         | 
| 808 812 | 
             
            - lib/spree/preferences/static_model_preferences.rb
         | 
| 809 813 | 
             
            - lib/spree/preferences/statically_configurable.rb
         | 
| @@ -903,7 +907,7 @@ files: | |
| 903 907 | 
             
            - lib/spree/testing_support/url_helpers.rb
         | 
| 904 908 | 
             
            - lib/spree/user_class_handle.rb
         | 
| 905 909 | 
             
            - lib/spree_core.rb
         | 
| 906 | 
            -
            - lib/tasks/ | 
| 910 | 
            +
            - lib/tasks/solidus/delete_prices_with_nil_amount.rake
         | 
| 907 911 | 
             
            - solidus_core.gemspec
         | 
| 908 912 | 
             
            - vendor/assets/javascripts/jquery.payment.js
         | 
| 909 913 | 
             
            - vendor/assets/javascripts/jsuri.js
         | 
| @@ -1,24 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module Spree
         | 
| 4 | 
            -
              module Tax
         | 
| 5 | 
            -
                # Used to build shipping rate taxes
         | 
| 6 | 
            -
                class ShippingRateTaxer
         | 
| 7 | 
            -
                  # Build shipping rate taxes for a shipping rate
         | 
| 8 | 
            -
                  # Modifies the passed-in shipping rate with associated shipping rate taxes.
         | 
| 9 | 
            -
                  # @param [Spree::ShippingRate] shipping_rate The shipping rate to add taxes to.
         | 
| 10 | 
            -
                  #   This parameter will be modified.
         | 
| 11 | 
            -
                  # @return [Spree::ShippingRate] The shipping rate with associated tax objects
         | 
| 12 | 
            -
                  def tax(shipping_rate)
         | 
| 13 | 
            -
                    taxes = Spree::Config.shipping_rate_tax_calculator_class.new(shipping_rate.order).calculate(shipping_rate)
         | 
| 14 | 
            -
                    taxes.each do |tax|
         | 
| 15 | 
            -
                      shipping_rate.taxes.build(
         | 
| 16 | 
            -
                        amount: tax.amount,
         | 
| 17 | 
            -
                        tax_rate: tax.tax_rate
         | 
| 18 | 
            -
                      )
         | 
| 19 | 
            -
                    end
         | 
| 20 | 
            -
                    shipping_rate
         | 
| 21 | 
            -
                  end
         | 
| 22 | 
            -
                end
         | 
| 23 | 
            -
              end
         | 
| 24 | 
            -
            end
         | 
    
        data/lib/tasks/upgrade.rake
    DELETED
    
    | @@ -1,15 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            namespace :solidus do
         | 
| 4 | 
            -
              namespace :upgrade do
         | 
| 5 | 
            -
                task three_point_zero: [
         | 
| 6 | 
            -
                    'railties:install:migrations',
         | 
| 7 | 
            -
                    'db:migrate'
         | 
| 8 | 
            -
                  ] do
         | 
| 9 | 
            -
                  puts "Your Solidus install is ready for Solidus 3.0"
         | 
| 10 | 
            -
                end
         | 
| 11 | 
            -
              end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
              desc "Upgrade to the current Solidus version"
         | 
| 14 | 
            -
              task upgrade: 'upgrade:three_point_zero'
         | 
| 15 | 
            -
            end
         |