solidus_core 2.11.1 → 3.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_core might be problematic. Click here for more details.

Files changed (198) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree.js.erb +0 -51
  3. data/app/helpers/spree/store_helper.rb +0 -11
  4. data/app/mailers/spree/carton_mailer.rb +1 -5
  5. data/app/models/concerns/spree/adjustment_source.rb +0 -15
  6. data/app/models/concerns/spree/calculated_adjustments.rb +0 -18
  7. data/app/models/concerns/spree/soft_deletable.rb +2 -4
  8. data/app/models/concerns/spree/user_address_book.rb +0 -37
  9. data/app/models/concerns/spree/user_methods.rb +2 -11
  10. data/app/models/spree/ability.rb +0 -37
  11. data/app/models/spree/address.rb +7 -162
  12. data/app/models/spree/address/name.rb +2 -20
  13. data/app/models/spree/adjustment.rb +0 -28
  14. data/app/models/spree/base.rb +1 -12
  15. data/app/models/spree/calculator.rb +4 -11
  16. data/app/models/spree/calculator/flexi_rate.rb +0 -5
  17. data/app/models/spree/country.rb +1 -6
  18. data/app/models/spree/credit_card.rb +0 -27
  19. data/app/models/spree/customer_return.rb +1 -4
  20. data/app/models/spree/image.rb +0 -7
  21. data/app/models/spree/inventory_unit.rb +0 -21
  22. data/app/models/spree/line_item.rb +2 -45
  23. data/app/models/spree/order.rb +3 -136
  24. data/app/models/spree/order/payments.rb +2 -2
  25. data/app/models/spree/order_cancellations.rb +4 -24
  26. data/app/models/spree/order_merger.rb +1 -1
  27. data/app/models/spree/order_updater.rb +2 -11
  28. data/app/models/spree/payment.rb +10 -6
  29. data/app/models/spree/payment/cancellation.rb +3 -22
  30. data/app/models/spree/payment_create.rb +1 -13
  31. data/app/models/spree/payment_method.rb +2 -103
  32. data/app/models/spree/payment_method/credit_card.rb +1 -3
  33. data/app/models/spree/payment_source.rb +2 -2
  34. data/app/models/spree/product.rb +8 -41
  35. data/app/models/spree/product/scopes.rb +0 -28
  36. data/app/models/spree/promotion.rb +2 -6
  37. data/app/models/spree/promotion/actions/create_adjustment.rb +0 -3
  38. data/app/models/spree/promotion/actions/create_item_adjustments.rb +0 -3
  39. data/app/models/spree/promotion/actions/create_quantity_adjustments.rb +0 -3
  40. data/app/models/spree/promotion/rules/taxon.rb +2 -15
  41. data/app/models/spree/promotion_action.rb +2 -9
  42. data/app/models/spree/promotion_code/batch_builder.rb +0 -14
  43. data/app/models/spree/refund.rb +3 -47
  44. data/app/models/spree/reimbursement.rb +3 -41
  45. data/app/models/spree/reimbursement_performer.rb +2 -8
  46. data/app/models/spree/reimbursement_type/credit.rb +1 -4
  47. data/app/models/spree/reimbursement_type/reimbursement_helpers.rb +1 -2
  48. data/app/models/spree/reimbursement_type/store_credit.rb +1 -4
  49. data/app/models/spree/return_authorization.rb +1 -4
  50. data/app/models/spree/return_item.rb +1 -19
  51. data/app/models/spree/shipment.rb +1 -54
  52. data/app/models/spree/shipping_method.rb +1 -26
  53. data/app/models/spree/shipping_rate.rb +0 -2
  54. data/app/models/spree/state.rb +0 -4
  55. data/app/models/spree/stock/availability_validator.rb +2 -2
  56. data/app/models/spree/stock/inventory_validator.rb +2 -2
  57. data/app/models/spree/stock/simple_coordinator.rb +0 -14
  58. data/app/models/spree/stock/splitter/base.rb +2 -7
  59. data/app/models/spree/stock_item.rb +1 -7
  60. data/app/models/spree/store.rb +0 -12
  61. data/app/models/spree/store_credit_category.rb +0 -32
  62. data/app/models/spree/tax_calculator/shipping_rate.rb +1 -12
  63. data/app/models/spree/tax_rate.rb +0 -27
  64. data/app/models/spree/taxon.rb +0 -11
  65. data/app/models/spree/taxon/active_storage_attachment.rb +0 -6
  66. data/app/models/spree/taxon/paperclip_attachment.rb +0 -4
  67. data/app/models/spree/user_address.rb +0 -5
  68. data/app/models/spree/variant.rb +1 -45
  69. data/config/locales/en.yml +0 -8
  70. data/db/migrate/20210122110141_add_name_to_spree_addresses.rb +13 -0
  71. data/lib/generators/solidus/install/install_generator.rb +12 -1
  72. data/lib/generators/solidus/install/templates/config/initializers/spree.rb.tt +3 -39
  73. data/lib/generators/spree/dummy/dummy_generator.rb +2 -1
  74. data/lib/generators/spree/dummy/templates/rails/database.yml +6 -1
  75. data/lib/generators/spree/dummy/templates/rails/storage.yml +3 -0
  76. data/lib/generators/spree/dummy/templates/rails/test.rb +6 -1
  77. data/lib/spree/app_configuration.rb +7 -66
  78. data/lib/spree/core.rb +10 -12
  79. data/lib/spree/core/class_constantizer.rb +2 -0
  80. data/lib/spree/core/controller_helpers/auth.rb +1 -14
  81. data/lib/spree/core/controller_helpers/order.rb +2 -22
  82. data/lib/spree/core/controller_helpers/payment_parameters.rb +0 -54
  83. data/lib/spree/core/controller_helpers/pricing.rb +0 -8
  84. data/lib/spree/core/controller_helpers/strong_parameters.rb +0 -4
  85. data/lib/spree/core/engine.rb +6 -42
  86. data/lib/spree/core/environment_extension.rb +0 -9
  87. data/lib/spree/core/product_filters.rb +0 -40
  88. data/lib/spree/core/role_configuration.rb +0 -14
  89. data/lib/spree/core/search/base.rb +0 -26
  90. data/lib/spree/core/state_machines.rb +2 -11
  91. data/lib/spree/core/version.rb +1 -1
  92. data/lib/spree/event.rb +0 -31
  93. data/lib/spree/event/configuration.rb +0 -5
  94. data/lib/spree/event/subscriber.rb +0 -18
  95. data/lib/spree/event/subscriber_registry.rb +3 -1
  96. data/lib/spree/i18n.rb +0 -22
  97. data/lib/spree/money.rb +3 -18
  98. data/lib/spree/permitted_attributes.rb +2 -53
  99. data/lib/spree/testing_support.rb +31 -0
  100. data/lib/spree/testing_support/capybara_ext.rb +0 -30
  101. data/lib/spree/testing_support/controller_requests.rb +0 -82
  102. data/lib/spree/testing_support/dummy_app.rb +10 -16
  103. data/lib/spree/testing_support/dummy_app/mailer_previews/test_mailer_preview.rb +4 -0
  104. data/lib/spree/testing_support/dummy_app/migrations.rb +0 -3
  105. data/lib/spree/testing_support/factories.rb +8 -4
  106. data/lib/spree/testing_support/factories/address_factory.rb +6 -2
  107. data/lib/spree/testing_support/factories/adjustment_factory.rb +10 -5
  108. data/lib/spree/testing_support/factories/adjustment_reason_factory.rb +5 -0
  109. data/lib/spree/testing_support/factories/calculator_factory.rb +5 -0
  110. data/lib/spree/testing_support/factories/carton_factory.rb +7 -2
  111. data/lib/spree/testing_support/factories/country_factory.rb +5 -0
  112. data/lib/spree/testing_support/factories/credit_card_factory.rb +5 -0
  113. data/lib/spree/testing_support/factories/customer_return_factory.rb +8 -3
  114. data/lib/spree/testing_support/factories/image_factory.rb +5 -0
  115. data/lib/spree/testing_support/factories/inventory_unit_factory.rb +9 -4
  116. data/lib/spree/testing_support/factories/line_item_factory.rb +7 -2
  117. data/lib/spree/testing_support/factories/option_type_factory.rb +8 -0
  118. data/lib/spree/testing_support/factories/option_value_factory.rb +5 -0
  119. data/lib/spree/testing_support/factories/order_factory.rb +11 -7
  120. data/lib/spree/testing_support/factories/order_promotion_factory.rb +7 -2
  121. data/lib/spree/testing_support/factories/payment_factory.rb +9 -4
  122. data/lib/spree/testing_support/factories/payment_method_factory.rb +5 -0
  123. data/lib/spree/testing_support/factories/price_factory.rb +6 -1
  124. data/lib/spree/testing_support/factories/product_factory.rb +10 -5
  125. data/lib/spree/testing_support/factories/product_option_type_factory.rb +7 -2
  126. data/lib/spree/testing_support/factories/product_property_factory.rb +7 -2
  127. data/lib/spree/testing_support/factories/promotion_category_factory.rb +5 -0
  128. data/lib/spree/testing_support/factories/promotion_code_factory.rb +7 -2
  129. data/lib/spree/testing_support/factories/promotion_factory.rb +7 -2
  130. data/lib/spree/testing_support/factories/property_factory.rb +5 -0
  131. data/lib/spree/testing_support/factories/refund_factory.rb +7 -3
  132. data/lib/spree/testing_support/factories/refund_reason_factory.rb +5 -0
  133. data/lib/spree/testing_support/factories/reimbursement_factory.rb +6 -1
  134. data/lib/spree/testing_support/factories/reimbursement_type_factory.rb +5 -0
  135. data/lib/spree/testing_support/factories/return_authorization_factory.rb +8 -3
  136. data/lib/spree/testing_support/factories/return_item_factory.rb +8 -3
  137. data/lib/spree/testing_support/factories/return_reason_factory.rb +5 -0
  138. data/lib/spree/testing_support/factories/role_factory.rb +5 -0
  139. data/lib/spree/testing_support/factories/shipment_factory.rb +9 -3
  140. data/lib/spree/testing_support/factories/shipping_category_factory.rb +5 -0
  141. data/lib/spree/testing_support/factories/shipping_method_factory.rb +8 -3
  142. data/lib/spree/testing_support/factories/shipping_rate_factory.rb +7 -2
  143. data/lib/spree/testing_support/factories/state_factory.rb +7 -1
  144. data/lib/spree/testing_support/factories/stock_item_factory.rb +7 -2
  145. data/lib/spree/testing_support/factories/stock_location_factory.rb +8 -3
  146. data/lib/spree/testing_support/factories/stock_movement_factory.rb +6 -1
  147. data/lib/spree/testing_support/factories/stock_package_factory.rb +7 -2
  148. data/lib/spree/testing_support/factories/store_credit_category_factory.rb +5 -0
  149. data/lib/spree/testing_support/factories/store_credit_event_factory.rb +7 -2
  150. data/lib/spree/testing_support/factories/store_credit_factory.rb +8 -3
  151. data/lib/spree/testing_support/factories/store_credit_reason_factory.rb +5 -0
  152. data/lib/spree/testing_support/factories/store_credit_type_factory.rb +5 -0
  153. data/lib/spree/testing_support/factories/store_factory.rb +6 -1
  154. data/lib/spree/testing_support/factories/tax_category_factory.rb +7 -1
  155. data/lib/spree/testing_support/factories/tax_rate_factory.rb +8 -3
  156. data/lib/spree/testing_support/factories/taxon_factory.rb +6 -1
  157. data/lib/spree/testing_support/factories/taxonomy_factory.rb +5 -0
  158. data/lib/spree/testing_support/factories/user_factory.rb +8 -3
  159. data/lib/spree/testing_support/factories/variant_factory.rb +9 -4
  160. data/lib/spree/testing_support/factories/variant_property_rule_condition_factory.rb +7 -2
  161. data/lib/spree/testing_support/factories/variant_property_rule_factory.rb +8 -3
  162. data/lib/spree/testing_support/factories/variant_property_rule_value_factory.rb +7 -2
  163. data/lib/spree/testing_support/factories/zone_factory.rb +7 -2
  164. data/lib/spree/testing_support/factory_bot.rb +68 -0
  165. data/lib/spree/testing_support/order_walkthrough.rb +10 -13
  166. data/lib/spree/testing_support/preferences.rb +0 -25
  167. data/lib/spree/testing_support/sequences.rb +4 -1
  168. data/{app/models → lib}/spree/user_class_handle.rb +0 -0
  169. data/lib/tasks/migrations/migrate_address_names.rake +158 -0
  170. data/lib/tasks/migrations/migrate_default_billing_addresses_to_address_book.rake +38 -0
  171. data/lib/tasks/upgrade.rake +13 -0
  172. data/solidus_core.gemspec +3 -4
  173. metadata +32 -63
  174. data/app/mailers/spree/test_mailer.rb +0 -13
  175. data/app/models/concerns/spree/user_payment_source.rb +0 -26
  176. data/app/models/spree/calculator/free_shipping.rb +0 -21
  177. data/app/models/spree/calculator/percent_per_item.rb +0 -49
  178. data/app/models/spree/calculator/price_sack.rb +0 -27
  179. data/app/models/spree/gateway.rb +0 -14
  180. data/app/models/spree/gateway/bogus.rb +0 -13
  181. data/app/models/spree/gateway/bogus_simple.rb +0 -13
  182. data/app/models/spree/order/checkout.rb +0 -244
  183. data/app/models/spree/order_capturing.rb +0 -50
  184. data/app/models/spree/promotion_handler/free_shipping.rb +0 -9
  185. data/lib/generators/spree/install/install_generator.rb +0 -15
  186. data/lib/solidus/migrations/rename_gateways.rb +0 -41
  187. data/lib/spree/awesome_nested_set_override.rb +0 -44
  188. data/lib/spree/core/current_store.rb +0 -24
  189. data/lib/spree/paranoia_deprecations.rb +0 -41
  190. data/lib/spree/promo/environment.rb +0 -12
  191. data/lib/spree/testing_support/bar_ability.rb +0 -19
  192. data/lib/tasks/core.rake +0 -104
  193. data/lib/tasks/email.rake +0 -11
  194. data/lib/tasks/migrations/copy_order_bill_address_to_credit_card.rake +0 -119
  195. data/lib/tasks/migrations/migrate_shipping_rate_taxes.rake +0 -22
  196. data/lib/tasks/migrations/migrate_user_addresses.rake +0 -34
  197. data/lib/tasks/migrations/rename_gateways.rake +0 -23
  198. data/lib/tasks/order_capturing.rake +0 -27
@@ -83,7 +83,7 @@ module Spree
83
83
  after_save :clear_in_stock_cache
84
84
  after_touch :clear_in_stock_cache
85
85
 
86
- after_real_destroy :destroy_option_values_variants
86
+ after_destroy :destroy_option_values_variants
87
87
 
88
88
  # Returns variants that are in stock. When stock locations are provided as
89
89
  # a parameter, the scope is limited to variants that are in stock in the
@@ -121,17 +121,6 @@ module Spree
121
121
  self.whitelisted_ransackable_associations = %w[option_values product prices default_price]
122
122
  self.whitelisted_ransackable_attributes = %w[weight sku]
123
123
 
124
- # Returns variants that are not deleted and have a price in the given
125
- # currency.
126
- #
127
- # @deprecated Please use the .with_prices scope instead
128
- # @param currency [String] the currency to filter by; defaults to Spree's default
129
- # @return [ActiveRecord::Relation]
130
- def self.active(currency = nil)
131
- Spree::Deprecation.warn("`Variant.active(currency)` is deprecated. Please use `Variant.with_prices(pricing_options)` instead.", caller)
132
- joins(:prices).where(deleted_at: nil).where('spree_prices.currency' => currency || Spree::Config[:currency]).where('spree_prices.amount IS NOT NULL')
133
- end
134
-
135
124
  # Returns variants that have a price for the given pricing options
136
125
  # If you have modified the pricing options class, you might want to modify this scope too.
137
126
  #
@@ -304,26 +293,6 @@ module Spree
304
293
  diff && diff.zero?
305
294
  end
306
295
 
307
- # Converts the variant's price to the given currency.
308
- #
309
- # @deprecated Please use #price_for(pricing_options) instead
310
- # @param currency [String] the desired currency
311
- # @return [Spree::Price] the price in the desired currency
312
- def price_in(currency)
313
- prices.currently_valid.find_by(currency: currency)
314
- end
315
- deprecate price_in: :price_for, deprecator: Spree::Deprecation
316
-
317
- # Fetches the price amount in the specified currency.
318
- #
319
- # @deprecated Please use #price_for instead and use a money object rathern than a BigDecimal.
320
- # @param currency (see #price)
321
- # @return [Float] the amount in the specified currency.
322
- def amount_in(currency)
323
- price_in(currency).try(:amount)
324
- end
325
- deprecate amount_in: :price_for, deprecator: Spree::Deprecation
326
-
327
296
  # Generates a friendly name and sku string.
328
297
  #
329
298
  # @return [String]
@@ -367,19 +336,6 @@ module Spree
367
336
  track_inventory? && Spree::Config.track_inventory_levels
368
337
  end
369
338
 
370
- # Image that can be used for the variant.
371
- #
372
- # Will first search for images on the variant. If it doesn't find any,
373
- # it'll fallback to any variant image (unless +fallback+ is +false+) or to
374
- # a new {Spree::Image}.
375
- # @param fallback [Boolean] whether or not we should fallback to an image
376
- # not from this variant
377
- # @return [Spree::Image] the image to display
378
- def display_image(fallback: true)
379
- Spree::Deprecation.warn('Spree::Variant#display_image is DEPRECATED. Choose an image from Spree::Variant#gallery instead')
380
- images.first || (fallback && product.variant_images.first) || Spree::Image.new
381
- end
382
-
383
339
  # Determines the variant's property values by verifying which of the product's
384
340
  # variant property rules apply to itself.
385
341
  #
@@ -26,8 +26,6 @@ en:
26
26
  address2: Street Address (cont'd)
27
27
  city: City
28
28
  company: Company
29
- firstname: First Name
30
- lastname: Last Name
31
29
  name: Name
32
30
  phone: Phone
33
31
  zipcode: Zip Code
@@ -76,7 +74,6 @@ en:
76
74
  created_at: Date/Time
77
75
  name: Name
78
76
  number: Return Number
79
- pre_tax_total: Pre-Tax Total
80
77
  reimbursement_status: Reimbursement status
81
78
  total: Total
82
79
  total_excluding_vat: Pre-Tax Total
@@ -130,8 +127,6 @@ en:
130
127
  spree/order/bill_address:
131
128
  address1: Billing address street
132
129
  city: Billing address city
133
- firstname: Billing address first name
134
- lastname: Billing address last name
135
130
  name: Billing address name
136
131
  phone: Billing address phone
137
132
  state: Billing address state
@@ -139,8 +134,6 @@ en:
139
134
  spree/order/ship_address:
140
135
  address1: Shipping address street
141
136
  city: Shipping address city
142
- firstname: Shipping address first name
143
- lastname: Shipping address last name
144
137
  name: Shipping address name
145
138
  phone: Shipping address phone
146
139
  state: Shipping address state
@@ -282,7 +275,6 @@ en:
282
275
  type: Type
283
276
  spree/return_authorization:
284
277
  amount: Amount
285
- pre_tax_total: Pre-Tax Total
286
278
  total_excluding_vat: Pre-Tax Total
287
279
  spree/return_item:
288
280
  acceptance_status: Acceptance Status
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddNameToSpreeAddresses < ActiveRecord::Migration[5.2]
4
+ def up
5
+ add_column :spree_addresses, :name, :string
6
+ add_index :spree_addresses, :name
7
+ end
8
+
9
+ def down
10
+ remove_index :spree_addresses, :name
11
+ remove_column :spree_addresses, :name
12
+ end
13
+ end
@@ -15,6 +15,7 @@ module Solidus
15
15
  class_option :migrate, type: :boolean, default: true, banner: 'Run Solidus migrations'
16
16
  class_option :seed, type: :boolean, default: true, banner: 'Load seed data (migrations must be run)'
17
17
  class_option :sample, type: :boolean, default: true, banner: 'Load sample data (migrations must be run)'
18
+ class_option :active_storage, type: :boolean, default: true, banner: 'Install ActiveStorage as image attachments handler for products and taxons'
18
19
  class_option :auto_accept, type: :boolean
19
20
  class_option :user_class, type: :string
20
21
  class_option :admin_email, type: :string
@@ -51,6 +52,16 @@ module Solidus
51
52
  template 'config/initializers/spree.rb.tt', 'config/initializers/spree.rb'
52
53
  end
53
54
 
55
+ def install_file_attachment
56
+ if options[:active_storage]
57
+ say "Installing Active Storage", :green
58
+ rake 'active_storage:install'
59
+ else
60
+ say "Installing Paperclip", :green
61
+ gsub_file 'config/initializers/spree.rb', "ActiveStorageAttachment", "PaperclipAttachment"
62
+ end
63
+ end
64
+
54
65
  def additional_tweaks
55
66
  return unless File.exist? 'public/robots.txt'
56
67
 
@@ -174,7 +185,7 @@ module Solidus
174
185
  run "spring stop"
175
186
 
176
187
  @plugin_generators_to_run.each do |plugin_generator_name|
177
- generate "#{plugin_generator_name} --skip_migrations=false"
188
+ generate "#{plugin_generator_name} --skip_migrations=true"
178
189
  end
179
190
  end
180
191
 
@@ -10,15 +10,6 @@ Spree.config do |config|
10
10
  # from address for transactional emails
11
11
  config.mails_from = "store@example.com"
12
12
 
13
- # Use combined first and last name attribute in HTML views and API responses
14
- config.use_combined_first_and_last_name_in_address = true
15
-
16
- # Use legacy Spree::Order state machine
17
- config.use_legacy_order_state_machine = false
18
-
19
- # Use the legacy address' state validation logic
20
- config.use_legacy_address_state_validator = false
21
-
22
13
  # Uncomment to stop tracking inventory levels in the application
23
14
  # config.track_inventory_levels = false
24
15
 
@@ -27,38 +18,11 @@ Spree.config do |config|
27
18
  # any inventory changes.
28
19
  # config.inventory_cache_threshold = 3
29
20
 
30
- # Enable Paperclip adapter for attachments on images and taxons
31
- config.image_attachment_module = 'Spree::Image::PaperclipAttachment'
32
- config.taxon_attachment_module = 'Spree::Taxon::PaperclipAttachment'
33
-
34
- # Disable legacy Solidus custom CanCanCan actions aliases
35
- config.use_custom_cancancan_actions = false
21
+ # Configure adapter for attachments on products and taxons (use ActiveStorageAttachment or PaperclipAttachment)
22
+ config.image_attachment_module = 'Spree::Image::ActiveStorageAttachment'
23
+ config.taxon_attachment_module = 'Spree::Taxon::ActiveStorageAttachment'
36
24
 
37
25
  # Defaults
38
-
39
- # Set this configuration to `true` to raise an exception when
40
- # an order is populated with a line item with a mismatching
41
- # currency. The `false` value will just add a validation error
42
- # and will be the only behavior accepted in future versions.
43
- # See https://github.com/solidusio/solidus/pull/3456 for more info.
44
- config.raise_with_invalid_currency = false
45
-
46
- # Set this configuration to false to always redirect the user to
47
- # /unauthorized when needed, without trying to redirect them to
48
- # their previous location first.
49
- config.redirect_back_on_unauthorized = true
50
-
51
- # Set this configuration to `true` to allow promotions
52
- # with no associated actions to be considered active for use by customers.
53
- # See https://github.com/solidusio/solidus/pull/3749 for more info.
54
- config.consider_actionless_promotion_active = false
55
-
56
- # Set this configuration to `false` to avoid running validations when
57
- # updating an order. Be careful since you can end up having inconsistent
58
- # data in your database turning it on.
59
- # See https://github.com/solidusio/solidus/pull/3645 for more info.
60
- config.run_order_validations_on_order_updater = true
61
-
62
26
  # Permission Sets:
63
27
 
64
28
  # Uncomment and customize the following line to add custom permission sets
@@ -43,7 +43,7 @@ module Spree
43
43
  opts[:skip_test] = true
44
44
  opts[:skip_yarn] = true
45
45
  opts[:skip_bootsnap] = true
46
- opts[:skip_webpack_install] = true
46
+ opts[:skip_javascript] = true
47
47
 
48
48
  puts "Generating dummy Rails application..."
49
49
  invoke Rails::Generators::AppGenerator,
@@ -55,6 +55,7 @@ module Spree
55
55
  @database = options[:database]
56
56
 
57
57
  template "rails/database.yml", "#{dummy_path}/config/database.yml", force: true
58
+ template "rails/storage.yml", "#{dummy_path}/config/storage/test.yml", force: true
58
59
  template "rails/boot.rb", "#{dummy_path}/config/boot.rb", force: true
59
60
  template "rails/application.rb.tt", "#{dummy_path}/config/application.rb", force: true
60
61
  template "rails/routes.rb", "#{dummy_path}/config/routes.rb", force: true
@@ -32,6 +32,8 @@ production:
32
32
  encoding: utf8
33
33
  <% when 'postgres', 'postgresql' %>
34
34
  <% db_host = ENV['DB_HOST'] -%>
35
+ <% db_username = ENV['DB_USERNAME'] -%>
36
+ <% db_password = ENV['DB_PASSWORD'] -%>
35
37
  development:
36
38
  adapter: postgresql
37
39
  database: <%= database_prefix %><%= options[:lib_name] %>_solidus_development
@@ -43,7 +45,10 @@ development:
43
45
  test:
44
46
  adapter: postgresql
45
47
  database: <%= database_prefix %><%= options[:lib_name] %>_solidus_test
46
- username: postgres
48
+ username: <%= db_username || 'postgres' %>
49
+ <% unless db_password.blank? %>
50
+ password: <%= db_password %>
51
+ <% end %>
47
52
  min_messages: warning
48
53
  <% unless db_host.blank? %>
49
54
  host: <%= db_host %>
@@ -0,0 +1,3 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= File.expand_path("#{dummy_path}/tmp/storage", destination_root) %>
@@ -20,11 +20,16 @@ Dummy::Application.configure do
20
20
  # Raise exceptions instead of rendering exception templates
21
21
  config.action_dispatch.show_exceptions = false
22
22
 
23
+ # Disable request forgery protection in test environment
24
+ config.action_controller.allow_forgery_protection = false
25
+
23
26
  # Tell Action Mailer not to deliver emails to the real world.
24
27
  # The :test delivery method accumulates sent emails in the
25
28
  # ActionMailer::Base.deliveries array.
26
29
  config.action_mailer.delivery_method = :test
27
- ActionMailer::Base.default from: "spree@example.com"
30
+ ActionMailer::Base.default from: "solidus@example.com"
31
+
32
+ config.active_storage.service = :test
28
33
 
29
34
  # Raise on deprecation warnings
30
35
  if ENV['SOLIDUS_RAISE_DEPRECATIONS'].present?
@@ -34,10 +34,6 @@ module Spree
34
34
  # @return [Boolean] should state/state_name be required (default: +true+)
35
35
  preference :address_requires_state, :boolean, default: true
36
36
 
37
- # @!attribute [rw] legacy
38
- # @return [Boolean] use the legacy address' state validation logic (default: +true+)
39
- preference :use_legacy_address_state_validator, :boolean, default: true
40
-
41
37
  # @!attribute [rw] admin_interface_logo
42
38
  # @return [String] URL of logo used in admin (default: +'logo/solidus.svg'+)
43
39
  preference :admin_interface_logo, :string, default: 'logo/solidus.svg'
@@ -111,16 +107,6 @@ module Spree
111
107
  # @return [Boolean]
112
108
  preference :billing_address_required, :boolean, default: false
113
109
 
114
- # @!attribute [rw] binary_inventory_cache
115
- # Only invalidate product caches when they change from in stock to out of
116
- # stock. By default, caches are invalidated on any change of inventory
117
- # quantity. Setting this to true should make operations on inventory
118
- # faster.
119
- # (default: +false+)
120
- # @deprecated - use inventory_cache_threshold instead
121
- # @return [Boolean]
122
- preference :binary_inventory_cache, :boolean, default: false
123
-
124
110
  # @!attribute [rw] can_restrict_stock_management
125
111
  # @return [Boolean] Indicates if stock management can be restricted by location
126
112
  preference :can_restrict_stock_management, :boolean, default: false
@@ -154,20 +140,11 @@ module Spree
154
140
  # @return [Integer] Customer returns to show per-page in the admin (default: +15+)
155
141
  preference :customer_returns_per_page, :integer, default: 15
156
142
 
157
- # @!attribute [rw] default_country_id
158
- # @deprecated Use the default country ISO preference instead
159
- # @return [Integer,nil] id of {Spree::Country} to be selected by default in dropdowns (default: nil)
160
- preference :default_country_id, :integer
161
-
162
143
  # @!attribute [rw] default_country_iso
163
144
  # Default customer country ISO code
164
145
  # @return [String] Two-letter ISO code of a {Spree::Country} to assumed as the country of an unidentified customer (default: "US")
165
146
  preference :default_country_iso, :string, default: 'US'
166
147
 
167
- # @!attribute [rw] use_custom_cancancan_actions
168
- # @return [Boolean] Allow to use legacy Solidus custom CanCanCan action aliases (default: +true+)
169
- preference :use_custom_cancancan_actions, :boolean, default: true
170
-
171
148
  # @!attribute [rw] generate_api_key_for_all_roles
172
149
  # @return [Boolean] Allow generating api key automatically for user
173
150
  # at role_user creation for all roles. (default: +false+)
@@ -190,7 +167,7 @@ module Spree
190
167
 
191
168
  # @!attribute [rw] mails_from
192
169
  # @return [String] Email address used as +From:+ field in transactional emails.
193
- preference :mails_from, :string, default: 'spree@example.com'
170
+ preference :mails_from, :string, default: 'solidus@example.com'
194
171
 
195
172
  # @!attribute [rw] max_level_in_taxons_menu
196
173
  # @return [Integer] maximum nesting level in taxons menu (default: +1+)
@@ -225,23 +202,6 @@ module Spree
225
202
  # @return [Integer] Promotions to show per-page in the admin (default: +15+)
226
203
  preference :promotions_per_page, :integer, default: 15
227
204
 
228
- # @!attribute [rw] disable_actionless_promotion_validation
229
- # @return [Boolean] Promotions should have actions associated before being considered active (default: +true+)
230
- preference :consider_actionless_promotion_active, :boolean, default: true
231
-
232
- # @!attribute [rw] raise_with_invalid_currency
233
- # Whether to raise an exception if trying to set a line item currency
234
- # different from the order currency. When false a validation error
235
- # is added to the instance instead.
236
- # @return [Boolean] (default: +true+)
237
- preference :raise_with_invalid_currency, :boolean, default: true
238
-
239
- # @!attribute [rw] redirect_back_on_unauthorized
240
- # Whether to try to redirect users back when they try to access
241
- # unauthorized routes, before redirect them to /unauthorized.
242
- # @return [Boolean] (default: +false+)
243
- preference :redirect_back_on_unauthorized, :boolean, default: false
244
-
245
205
  # @!attribute [rw] require_master_price
246
206
  # @return [Boolean] Require a price on the master variant of a product (default: +true+)
247
207
  preference :require_master_price, :boolean, default: true
@@ -268,10 +228,6 @@ module Spree
268
228
  # (default: +['IT']+)
269
229
  preference :countries_that_use_nested_subregions, :array, default: ['IT']
270
230
 
271
- # @!attribute [rw] run_order_validations_on_order_updater
272
- # @return [Boolean] Whether to run validation when updating an order with the OrderUpdater
273
- preference :run_order_validations_on_order_updater, :boolean, default: false
274
-
275
231
  # @!attribute [rw] send_core_emails
276
232
  # @return [Boolean] Whether to send transactional emails (default: true)
277
233
  preference :send_core_emails, :boolean, default: true
@@ -307,21 +263,6 @@ module Spree
307
263
  # @return [] Track on_hand values for variants / products. (default: true)
308
264
  preference :track_inventory_levels, :boolean, default: true
309
265
 
310
- # @!attribute [rw] use_combined_first_and_last_name_in_address
311
- # @return [Boolean] Use Spree::Address combined first and last name in HTML views and
312
- # API responses. (default: +false+)
313
- preference :use_combined_first_and_last_name_in_address, :boolean, default: false
314
-
315
- # @!attribute [rw] use_legacy_order_state_machine
316
- # @return [Boolean] Uses the legacy order state machine from Spree::Order::Checkout
317
- # (default: +false+)
318
- preference :use_legacy_order_state_machine, :boolean, default: true
319
-
320
- # The legacy_store_credit_category_name allows to control whether the legacy
321
- # way of fetching the category should be used.
322
- #
323
- # @param [Boolean] enable/disable the legacy way of fetching the store category name
324
- preference :use_legacy_store_credit_reimbursement_category_name, :boolean, default: true
325
266
 
326
267
  # Other configurations
327
268
 
@@ -496,23 +437,23 @@ module Spree
496
437
 
497
438
  # Allows switching attachment library for Image
498
439
  #
499
- # `Spree::Image::PaperclipAttachment`
500
- # is the default and provides the classic Paperclip implementation.
440
+ # `Spree::Image::ActiveStorageAttachment`
441
+ # is the default and provides the Active Storage implementation.
501
442
  #
502
443
  # @!attribute [rw] image_attachment_module
503
444
  # @return [Module] a module that can be included into Spree::Image to allow attachments
504
445
  # Enumerable of images adhering to the present_image_class interface
505
- class_name_attribute :image_attachment_module, default: 'Spree::Image::PaperclipAttachment'
446
+ class_name_attribute :image_attachment_module, default: 'Spree::Image::ActiveStorageAttachment'
506
447
 
507
448
  # Allows switching attachment library for Taxon
508
449
  #
509
- # `Spree::Taxon::PaperclipAttachment`
510
- # is the default and provides the classic Paperclip implementation.
450
+ # `Spree::Taxon::ActiveStorageAttachment`
451
+ # is the default and provides the Active Storage implementation.
511
452
  #
512
453
  # @!attribute [rw] taxon_attachment_module
513
454
  # @return [Module] a module that can be included into Spree::Taxon to allow attachments
514
455
  # Enumerable of taxons adhering to the present_taxon_class interface
515
- class_name_attribute :taxon_attachment_module, default: 'Spree::Taxon::PaperclipAttachment'
456
+ class_name_attribute :taxon_attachment_module, default: 'Spree::Taxon::ActiveStorageAttachment'
516
457
 
517
458
  # Allows providing your own class instance for generating order numbers.
518
459
  #
data/lib/spree/core.rb CHANGED
@@ -1,6 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rails/all'
3
+ require "action_controller/railtie"
4
+ require "action_mailer/railtie"
5
+ require "action_view/railtie"
6
+ require "active_job/railtie"
7
+ require "active_model/railtie"
8
+ require "active_record/railtie"
9
+ require "active_storage/engine"
10
+ require "sprockets/railtie"
11
+
4
12
  require 'acts_as_list'
5
13
  require 'awesome_nested_set'
6
14
  require 'cancan'
@@ -9,12 +17,10 @@ require 'kaminari/activerecord'
9
17
  require 'mail'
10
18
  require 'monetize'
11
19
  require 'paperclip'
12
- require 'paranoia'
13
20
  require 'ransack'
14
21
  require 'state_machines-activerecord'
15
22
 
16
23
  require 'spree/deprecation'
17
- require 'spree/paranoia_deprecations'
18
24
 
19
25
  # This is required because ActiveModel::Validations#invalid? conflicts with the
20
26
  # invalid state of a Payment. In the future this should be removed.
@@ -47,9 +53,6 @@ module Spree
47
53
 
48
54
  module Core
49
55
  class GatewayError < RuntimeError; end
50
-
51
- include ActiveSupport::Deprecation::DeprecatedConstantAccessor
52
- deprecate_constant 'DestroyWithOrdersError', ActiveRecord::DeleteRestrictionError, deprecator: Spree::Deprecation
53
56
  end
54
57
  end
55
58
 
@@ -61,7 +64,6 @@ require 'spree/core/environment_extension'
61
64
  require 'spree/core/environment/calculators'
62
65
  require 'spree/core/environment/promotions'
63
66
  require 'spree/core/environment'
64
- require 'spree/promo/environment'
65
67
  require 'spree/migrations'
66
68
  require 'spree/migration_helpers'
67
69
  require 'spree/event'
@@ -75,7 +77,6 @@ require 'spree/permitted_attributes'
75
77
  require 'spree/core/importer'
76
78
  require 'spree/core/permalinks'
77
79
  require 'spree/core/product_duplicator'
78
- require 'spree/core/current_store'
79
80
  require 'spree/core/controller_helpers/auth'
80
81
  require 'spree/core/controller_helpers/common'
81
82
  require 'spree/core/controller_helpers/current_host'
@@ -90,11 +91,8 @@ require 'spree/core/state_machines'
90
91
  require 'spree/core/stock_configuration'
91
92
  require 'spree/core/validators/email'
92
93
  require 'spree/permission_sets'
94
+ require 'spree/user_class_handle'
93
95
 
94
96
  require 'spree/preferences/store'
95
97
  require 'spree/preferences/static_model_preferences'
96
98
  require 'spree/preferences/scoped_store'
97
-
98
- if Rails.gem_version >= Gem::Version.new('6.1.0.alpha')
99
- require 'spree/awesome_nested_set_override'
100
- end