solidus_core 4.2.4 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/spree/named_type.rb +2 -0
- data/app/models/spree/address.rb +4 -2
- data/app/models/spree/adjustment.rb +1 -0
- data/app/models/spree/adjustment_reason.rb +2 -0
- data/app/models/spree/credit_card.rb +6 -3
- data/app/models/spree/order.rb +22 -8
- data/app/models/spree/payment_method/bogus_credit_card.rb +14 -9
- data/app/models/spree/payment_method/simple_bogus_credit_card.rb +12 -6
- data/app/models/spree/payment_method.rb +3 -1
- data/app/models/spree/preference.rb +1 -1
- data/app/models/spree/promotion/rules/minimum_quantity.rb +59 -0
- data/app/models/spree/promotion.rb +1 -1
- data/app/models/spree/refund_reason.rb +6 -1
- data/app/models/spree/reimbursement_type.rb +6 -1
- data/app/models/spree/return_item.rb +1 -1
- data/app/models/spree/return_reason.rb +6 -1
- data/app/models/spree/shipping_rate.rb +1 -2
- data/app/models/spree/stock_item.rb +1 -0
- data/app/models/spree/store.rb +2 -0
- data/app/models/spree/store_credit_reason.rb +6 -1
- data/app/models/spree/tax_rate.rb +4 -0
- data/app/models/spree/variant.rb +0 -5
- data/app/views/spree/order_mailer/inventory_cancellation_email.html.erb +0 -1
- data/config/locales/en.yml +12 -2
- data/db/migrate/20230427095534_drop_deprecated_address_id_from_shipments.rb +1 -1
- data/db/migrate/20231027084517_add_order_promotions_foreign_key.rb +10 -0
- data/db/migrate/20231031175215_add_promotion_order_promotion_foreign_key.rb +10 -0
- data/lib/generators/solidus/install/app_templates/frontend/starter.rb +1 -1
- data/lib/generators/solidus/install/install_generator.rb +53 -16
- data/lib/generators/solidus/install/templates/config/initializers/spree.rb.tt +9 -9
- data/lib/generators/spree/dummy/templates/rails/database.yml +41 -93
- data/lib/generators/spree/dummy/templates/rails/test.rb +1 -1
- data/lib/spree/app_configuration.rb +17 -2
- data/lib/spree/core/engine.rb +7 -5
- data/lib/spree/core/version.rb +2 -2
- data/lib/spree/core.rb +2 -0
- data/lib/spree/permitted_attributes.rb +1 -0
- data/lib/spree/preferences/persistable.rb +7 -1
- data/lib/spree/ransack_4_1_patch.rb +16 -0
- data/lib/spree/testing_support/dummy_app/database.yml +37 -46
- data/lib/spree/testing_support/dummy_app/rake_tasks.rb +1 -4
- data/lib/spree/testing_support/dummy_app.rb +21 -12
- data/solidus_core.gemspec +2 -2
- metadata +27 -23
@@ -34,11 +34,12 @@ module Solidus
|
|
34
34
|
class_option :seed, type: :boolean, default: true, banner: 'Load seed data (migrations must be run)'
|
35
35
|
class_option :sample, type: :boolean, default: true, banner: 'Load sample data (migrations and seeds must be run)'
|
36
36
|
class_option :active_storage, type: :boolean, default: true, banner: 'Install ActiveStorage as image attachments handler for products and taxons'
|
37
|
-
class_option :admin_preview, type: :boolean, default:
|
37
|
+
class_option :admin_preview, type: :boolean, default: true, desc: 'Install the admin preview'
|
38
38
|
class_option :auto_accept, type: :boolean
|
39
39
|
class_option :user_class, type: :string
|
40
40
|
class_option :admin_email, type: :string
|
41
41
|
class_option :admin_password, type: :string
|
42
|
+
class_option :mount_point, type: :string, desc: "Indicates where Solidus should be mounted. Defaults to '/'"
|
42
43
|
|
43
44
|
class_option :frontend, type: :string, enum: FRONTENDS.map { _1[:name] }, default: nil, desc: "Indicates which frontend to install."
|
44
45
|
class_option :authentication, type: :string, enum: AUTHENTICATIONS.map { _1[:name] }, default: nil, desc: "Indicates which authentication system to install."
|
@@ -87,6 +88,36 @@ module Solidus
|
|
87
88
|
ENV['SOLIDUS_SKIP_MIGRATIONS_CHECK'] = 'true'
|
88
89
|
end
|
89
90
|
|
91
|
+
def install_routes
|
92
|
+
if Pathname(app_path).join('config', 'routes.rb').read.include? CORE_MOUNT_ROUTE
|
93
|
+
say_status :route_exist, CORE_MOUNT_ROUTE, :blue
|
94
|
+
else
|
95
|
+
say_status :installing, "solidus routes"
|
96
|
+
mount_point = options[:mount_point] || ask_with_default(
|
97
|
+
desc: 'Where would you like to mount Solidus? (E.g. "/store" or "/shop")',
|
98
|
+
default: '/',
|
99
|
+
)
|
100
|
+
|
101
|
+
shell.mute do
|
102
|
+
route <<~RUBY
|
103
|
+
# This line mounts Solidus's routes at the root of your application.
|
104
|
+
#
|
105
|
+
# Unless you manually picked only a subset of Solidus components, this will mount routes for:
|
106
|
+
# - solidus_backend
|
107
|
+
# - solidus_api
|
108
|
+
# This means, any requests to URLs such as /admin/products, will go to Spree::Admin::ProductsController.
|
109
|
+
#
|
110
|
+
# If you are using the Starter Frontend as your frontend, be aware that all the storefront routes are defined
|
111
|
+
# separately in this file and are not part of the Solidus::Core::Engine engine.
|
112
|
+
#
|
113
|
+
# If you would like to change where this engine is mounted, simply change the :at option to something different.
|
114
|
+
# We ask that you don't use the :as option here, as Solidus relies on it being the default of "spree"
|
115
|
+
#{CORE_MOUNT_ROUTE}, at: '#{mount_point}'
|
116
|
+
RUBY
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
90
121
|
def add_files
|
91
122
|
template 'config/initializers/spree.rb.tt', 'config/initializers/spree.rb'
|
92
123
|
end
|
@@ -134,21 +165,6 @@ module Solidus
|
|
134
165
|
rake 'db:create'
|
135
166
|
end
|
136
167
|
|
137
|
-
def install_routes
|
138
|
-
if Pathname(app_path).join('config', 'routes.rb').read.include? CORE_MOUNT_ROUTE
|
139
|
-
say_status :route_exist, CORE_MOUNT_ROUTE, :blue
|
140
|
-
else
|
141
|
-
route <<~RUBY
|
142
|
-
# This line mounts Solidus's routes at the root of your application.
|
143
|
-
# This means, any requests to URLs such as /products, will go to Spree::ProductsController.
|
144
|
-
# If you would like to change where this engine is mounted, simply change the :at option to something different.
|
145
|
-
#
|
146
|
-
# We ask that you don't use the :as option here, as Solidus relies on it being the default of "spree"
|
147
|
-
#{CORE_MOUNT_ROUTE}, at: '/'
|
148
|
-
RUBY
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
168
|
def run_migrations
|
153
169
|
if @run_migrations
|
154
170
|
say_status :running, "migrations"
|
@@ -209,6 +225,27 @@ module Solidus
|
|
209
225
|
Bundler.reset_paths!
|
210
226
|
end
|
211
227
|
|
228
|
+
def ask_with_default(desc:, default:)
|
229
|
+
if options[:auto_accept]
|
230
|
+
say_status :using, "#{default} (default)"
|
231
|
+
return default
|
232
|
+
end
|
233
|
+
|
234
|
+
default_label = " (#{set_color :default, :bold}: \"#{default}\")" if default
|
235
|
+
|
236
|
+
say_status :question, "#{desc}#{default_label}.", :yellow
|
237
|
+
answer = ask(set_color("answer:".rjust(13), :blue, :bold)).to_s.downcase.presence
|
238
|
+
|
239
|
+
case answer
|
240
|
+
when nil
|
241
|
+
say_status :using, "#{default} (default)"
|
242
|
+
default
|
243
|
+
else
|
244
|
+
say_status :using, answer
|
245
|
+
answer
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
212
249
|
def ask_with_description(desc:, limited_to:, default:)
|
213
250
|
loop do
|
214
251
|
say_status :question, desc, :yellow
|
@@ -33,19 +33,19 @@ Spree.config do |config|
|
|
33
33
|
# Custom logo for the admin
|
34
34
|
# config.admin_interface_logo = "logo/solidus.svg"
|
35
35
|
|
36
|
-
#
|
36
|
+
# Payment gateway credentials can be configured statically here and referenced from
|
37
37
|
# the admin. They can also be fully configured from the admin.
|
38
38
|
#
|
39
|
-
# Please note that
|
40
|
-
#
|
39
|
+
# Please note that the example below requires the `solidus_stripe` ~> 5.0 gem
|
40
|
+
# in order to work properly (see https://github.com/solidusio-contrib/solidus_stripe).
|
41
41
|
#
|
42
42
|
# config.static_model_preferences.add(
|
43
|
-
#
|
44
|
-
# '
|
45
|
-
#
|
46
|
-
# publishable_key: ENV
|
47
|
-
#
|
48
|
-
#
|
43
|
+
# 'SolidusStripe::PaymentMethod',
|
44
|
+
# 'solidus_stripe_env_credentials',
|
45
|
+
# api_key: ENV.fetch('SOLIDUS_STRIPE_API_KEY'),
|
46
|
+
# publishable_key: ENV.fetch('SOLIDUS_STRIPE_PUBLISHABLE_KEY'),
|
47
|
+
# test_mode: ENV.fetch('SOLIDUS_STRIPE_API_KEY').start_with?('sk_test_'),
|
48
|
+
# webhook_endpoint_signing_secret: ENV.fetch('SOLIDUS_STRIPE_WEBHOOK_SIGNING_SECRET')
|
49
49
|
# )
|
50
50
|
end
|
51
51
|
|
@@ -1,113 +1,61 @@
|
|
1
|
-
<%
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
raise "Invalid DB specified: #{ENV['DB']}"
|
10
|
-
end %>
|
11
|
-
<% db_host = case db
|
12
|
-
when 'mysql'
|
13
|
-
ENV['DB_MYSQL_HOST'] || ENV['DB_HOST']
|
14
|
-
when 'postgres'
|
15
|
-
ENV['DB_POSTGRES_HOST'] || ENV['DB_HOST']
|
16
|
-
else
|
17
|
-
ENV['DB_HOST']
|
18
|
-
end %>
|
19
|
-
<% db_username = ENV['DB_USERNAME'] %>
|
20
|
-
<% db_password = ENV['DB_PASSWORD'] %>
|
1
|
+
<%
|
2
|
+
adapter =
|
3
|
+
case ENV['DB']
|
4
|
+
when 'mysql2', 'mysql' then 'mysql2'
|
5
|
+
when 'postgresql', 'postgres' then 'postgresql'
|
6
|
+
when 'sqlite3', 'sqlite', '', nil then 'sqlite3'
|
7
|
+
else raise "Invalid DB specified " + ENV['DB'].inspect
|
8
|
+
end
|
21
9
|
|
22
|
-
|
23
|
-
|
10
|
+
db_host =
|
11
|
+
case adapter
|
12
|
+
when 'mysql2' then ENV['DB_MYSQL_HOST'] || ENV['DB_HOST']
|
13
|
+
when 'postgres' then ENV['DB_POSTGRES_HOST'] || ENV['DB_HOST']
|
14
|
+
else ENV['DB_HOST']
|
15
|
+
end
|
16
|
+
|
17
|
+
db_username = ENV['DB_USERNAME']
|
18
|
+
db_password = ENV['DB_PASSWORD'] %>
|
19
|
+
|
20
|
+
default: &default
|
21
|
+
adapter: <%= adapter %>
|
22
|
+
<% unless db_username.blank? %>username: <%= db_username %><% end %>
|
23
|
+
<% unless db_password.blank? %>password: <%= db_password %><% end %>
|
24
|
+
<% unless db_host.blank? %>host: <%= db_host %><% end %>
|
25
|
+
<% if adapter == 'mysql2' %>encoding: utf8<% end %>
|
26
|
+
<% if adapter == 'postgresql' %>min_messages: warning<% end %>
|
27
|
+
|
28
|
+
<% if adapter == 'mysql2' %>
|
24
29
|
development:
|
25
|
-
|
30
|
+
<<: *default
|
26
31
|
database: <%= options[:lib_name] %>_solidus_development
|
27
|
-
<% unless db_username.blank? %>
|
28
|
-
username: <%= db_username %>
|
29
|
-
<% end %>
|
30
|
-
<% unless db_password.blank? %>
|
31
|
-
password: <%= db_password %>
|
32
|
-
<% end %>
|
33
|
-
<% unless db_host.blank? %>
|
34
|
-
host: <%= db_host %>
|
35
|
-
<% end %>
|
36
|
-
encoding: utf8
|
37
32
|
test:
|
38
|
-
|
33
|
+
<<: *default
|
39
34
|
database: <%= options[:lib_name] %>_solidus_test
|
40
|
-
<% unless db_username.blank? %>
|
41
|
-
username: <%= db_username %>
|
42
|
-
<% end %>
|
43
|
-
<% unless db_password.blank? %>
|
44
|
-
password: <%= db_password %>
|
45
|
-
<% end %>
|
46
|
-
<% unless db_host.blank? %>
|
47
|
-
host: <%= db_host %>
|
48
|
-
<% end %>
|
49
|
-
encoding: utf8
|
50
35
|
production:
|
51
|
-
|
36
|
+
<<: *default
|
52
37
|
database: <%= options[:lib_name] %>_solidus_production
|
53
|
-
|
54
|
-
|
55
|
-
<% end %>
|
56
|
-
<% unless db_password.blank? %>
|
57
|
-
password: <%= db_password %>
|
58
|
-
<% end %>
|
59
|
-
<% unless db_host.blank? %>
|
60
|
-
host: <%= db_host %>
|
61
|
-
<% end %>
|
62
|
-
encoding: utf8
|
63
|
-
<% when 'postgres', 'postgresql' %>
|
38
|
+
|
39
|
+
<% elsif adapter == 'postgresql' %>
|
64
40
|
development:
|
65
|
-
|
41
|
+
<<: *default
|
66
42
|
database: <%= options[:lib_name] %>_solidus_development
|
67
|
-
<% unless db_username.blank? %>
|
68
|
-
username: <%= db_username %>
|
69
|
-
<% end %>
|
70
|
-
<% unless db_password.blank? %>
|
71
|
-
password: <%= db_password %>
|
72
|
-
<% end %>
|
73
|
-
<% unless db_host.blank? %>
|
74
|
-
host: <%= db_host %>
|
75
|
-
<% end %>
|
76
|
-
min_messages: warning
|
77
43
|
test:
|
78
|
-
|
44
|
+
<<: *default
|
79
45
|
database: <%= options[:lib_name] %>_solidus_test
|
80
|
-
<% unless db_username.blank? %>
|
81
|
-
username: <%= db_username %>
|
82
|
-
<% end %>
|
83
|
-
<% unless db_password.blank? %>
|
84
|
-
password: <%= db_password %>
|
85
|
-
<% end %>
|
86
|
-
<% unless db_host.blank? %>
|
87
|
-
host: <%= db_host %>
|
88
|
-
<% end %>
|
89
|
-
min_messages: warning
|
90
46
|
production:
|
91
|
-
|
47
|
+
<<: *default
|
92
48
|
database: <%= options[:lib_name] %>_solidus_production
|
93
|
-
|
94
|
-
|
95
|
-
<% end %>
|
96
|
-
<% unless db_password.blank? %>
|
97
|
-
password: <%= db_password %>
|
98
|
-
<% end %>
|
99
|
-
<% unless db_host.blank? %>
|
100
|
-
host: <%= db_host %>
|
101
|
-
<% end %>
|
102
|
-
min_messages: warning
|
103
|
-
<% when 'sqlite', '', nil %>
|
49
|
+
|
50
|
+
<% elsif adapter == 'sqlite3' %>
|
104
51
|
development:
|
105
|
-
|
52
|
+
<<: *default
|
106
53
|
database: db/solidus_development.sqlite3
|
107
54
|
test:
|
108
|
-
|
55
|
+
<<: *default
|
109
56
|
database: db/solidus_test.sqlite3
|
110
57
|
production:
|
111
|
-
|
58
|
+
<<: *default
|
112
59
|
database: db/solidus_production.sqlite3
|
60
|
+
|
113
61
|
<% end %>
|
@@ -18,7 +18,7 @@ Dummy::Application.configure do
|
|
18
18
|
config.eager_load = false
|
19
19
|
|
20
20
|
# Raise exceptions instead of rendering exception templates
|
21
|
-
config.action_dispatch.show_exceptions = false
|
21
|
+
config.action_dispatch.show_exceptions = false # Should be :none for Rails 7.1+
|
22
22
|
|
23
23
|
# Disable request forgery protection in test environment
|
24
24
|
config.action_controller.allow_forgery_protection = false
|
@@ -22,8 +22,6 @@ require "spree/core/search/variant"
|
|
22
22
|
require 'spree/preferences/configuration'
|
23
23
|
require 'spree/core/environment'
|
24
24
|
|
25
|
-
require 'uri'
|
26
|
-
|
27
25
|
module Spree
|
28
26
|
class AppConfiguration < Preferences::Configuration
|
29
27
|
# Preferences (alphabetized to more easily lookup particular preferences)
|
@@ -367,6 +365,22 @@ module Spree
|
|
367
365
|
# Spree::OrderUpdater.
|
368
366
|
class_name_attribute :order_recalculator_class, default: 'Spree::OrderUpdater'
|
369
367
|
|
368
|
+
# Allows providing a different coupon code handler.
|
369
|
+
# @!attribute [rw] coupon_code_handler_class
|
370
|
+
# @see Spree::PromotionHandler::Coupon
|
371
|
+
# @return [Class] an object that conforms to the API of
|
372
|
+
# the standard coupon code handler class
|
373
|
+
# Spree::PromotionHandler::Coupon.
|
374
|
+
class_name_attribute :coupon_code_handler_class, default: 'Spree::PromotionHandler::Coupon'
|
375
|
+
|
376
|
+
# Allows providing a different shipping promotion handler.
|
377
|
+
# @!attribute [rw] shipping_promotion_handler_class
|
378
|
+
# @see Spree::PromotionHandler::Shipping
|
379
|
+
# @return [Class] an object that conforms to the API of
|
380
|
+
# the standard shipping promotion handler class
|
381
|
+
# Spree::PromotionHandler::Coupon.
|
382
|
+
class_name_attribute :shipping_promotion_handler_class, default: 'Spree::PromotionHandler::Shipping'
|
383
|
+
|
370
384
|
# Allows providing your own Mailer for promotion code batch mailer.
|
371
385
|
#
|
372
386
|
# @!attribute [rw] promotion_code_batch_mailer_class
|
@@ -667,6 +681,7 @@ module Spree
|
|
667
681
|
Spree::Promotion::Rules::UserLoggedIn
|
668
682
|
Spree::Promotion::Rules::OneUsePerUser
|
669
683
|
Spree::Promotion::Rules::Taxon
|
684
|
+
Spree::Promotion::Rules::MinimumQuantity
|
670
685
|
Spree::Promotion::Rules::NthOrder
|
671
686
|
Spree::Promotion::Rules::OptionValue
|
672
687
|
Spree::Promotion::Rules::FirstRepeatPurchaseSince
|
data/lib/spree/core/engine.rb
CHANGED
@@ -67,12 +67,14 @@ module Spree
|
|
67
67
|
end
|
68
68
|
|
69
69
|
# Load in mailer previews for apps to use in development.
|
70
|
-
initializer "spree.core.action_mailer.set_preview_path", after: "action_mailer.
|
71
|
-
|
72
|
-
solidus_preview_path = Spree::Core::Engine.root.join 'lib/spree/mailer_previews'
|
70
|
+
initializer "spree.core.action_mailer.set_preview_path", after: "action_mailer.set_autoload_paths" do
|
71
|
+
solidus_preview_path = Spree::Core::Engine.root.join("lib/spree/mailer_previews")
|
73
72
|
|
74
|
-
|
75
|
-
|
73
|
+
if ActionMailer::Base.respond_to? :preview_paths # Rails 7.1+
|
74
|
+
ActionMailer::Base.preview_paths << solidus_preview_path.to_s
|
75
|
+
else
|
76
|
+
ActionMailer::Base.preview_path = "{#{ActionMailer::Base.preview_path},#{solidus_preview_path}}"
|
77
|
+
end
|
76
78
|
end
|
77
79
|
|
78
80
|
initializer "spree.deprecator" do |app|
|
data/lib/spree/core/version.rb
CHANGED
data/lib/spree/core.rb
CHANGED
@@ -21,6 +21,8 @@ require 'paperclip'
|
|
21
21
|
require 'ransack'
|
22
22
|
require 'state_machines-activerecord'
|
23
23
|
|
24
|
+
require_relative './ransack_4_1_patch'
|
25
|
+
|
24
26
|
# This is required because ActiveModel::Validations#invalid? conflicts with the
|
25
27
|
# invalid state of a Payment. In the future this should be removed.
|
26
28
|
StateMachines::Machine.ignore_method_conflicts = true
|
@@ -7,7 +7,13 @@ module Spree
|
|
7
7
|
|
8
8
|
included do
|
9
9
|
include Spree::Preferences::Preferable
|
10
|
-
|
10
|
+
|
11
|
+
if method(:serialize).parameters.include?([:key, :type]) # Rails 7.1+
|
12
|
+
serialize :preferences, type: Hash, coder: YAML
|
13
|
+
else
|
14
|
+
serialize :preferences, Hash, coder: YAML
|
15
|
+
end
|
16
|
+
|
11
17
|
after_initialize :initialize_preference_defaults
|
12
18
|
end
|
13
19
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ransack/version"
|
4
|
+
|
5
|
+
return unless Ransack::VERSION.start_with?("4.1.")
|
6
|
+
|
7
|
+
module RansackNodeConditionPatch
|
8
|
+
private
|
9
|
+
|
10
|
+
# Waiting for https://github.com/activerecord-hackery/ransack/pull/1468
|
11
|
+
def casted_array?(predicate)
|
12
|
+
predicate.is_a?(Arel::Nodes::Casted) && predicate.value.is_a?(Array)
|
13
|
+
end
|
14
|
+
|
15
|
+
Ransack::Nodes::Condition.prepend(self)
|
16
|
+
end
|
@@ -1,54 +1,45 @@
|
|
1
|
-
<%
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
1
|
+
<%
|
2
|
+
adapter =
|
3
|
+
case ENV['DB']
|
4
|
+
when 'mysql2', 'mysql' then 'mysql2'
|
5
|
+
when 'postgresql', 'postgres' then 'postgresql'
|
6
|
+
when 'sqlite3', 'sqlite', '', nil then 'sqlite3'
|
7
|
+
else raise "Invalid DB specified " + ENV['DB'].inspect
|
8
|
+
end
|
9
|
+
|
10
|
+
db_host =
|
11
|
+
case adapter
|
12
|
+
when 'mysql' then ENV['DB_MYSQL_HOST'] || ENV['DB_HOST']
|
13
|
+
when 'postgres' then ENV['DB_POSTGRES_HOST'] || ENV['DB_HOST']
|
14
|
+
else ENV['DB_HOST']
|
15
|
+
end
|
16
|
+
|
17
|
+
db_prefix = ENV['LIB_NAME'].presence || "solidus"
|
18
|
+
db_username = ENV['DB_USERNAME']
|
19
|
+
db_password = ENV['DB_PASSWORD'] %>
|
20
|
+
|
21
|
+
default: &default
|
22
|
+
adapter: <%= adapter %>
|
23
|
+
<% unless db_username.blank? %>username: <%= db_username %><% end %>
|
24
|
+
<% unless db_password.blank? %>password: <%= db_password %><% end %>
|
25
|
+
<% unless db_host.blank? %>host: <%= db_host %><% end %>
|
26
|
+
<% if adapter == 'mysql2' %>encoding: utf8<% end %>
|
27
|
+
<% if adapter == 'postgresql' %>min_messages: warning<% end %>
|
28
|
+
|
29
|
+
<% if adapter == 'mysql2' %>
|
24
30
|
test:
|
25
|
-
|
31
|
+
<<: *default
|
26
32
|
database: <%= db_prefix %>_test
|
27
|
-
|
28
|
-
|
29
|
-
<% end %>
|
30
|
-
<% unless db_password.blank? %>
|
31
|
-
password: <%= db_password %>
|
32
|
-
<% end %>
|
33
|
-
<% unless db_host.blank? %>
|
34
|
-
host: <%= db_host %>
|
35
|
-
<% end %>
|
36
|
-
encoding: utf8
|
37
|
-
<% when 'postgres' %>
|
33
|
+
|
34
|
+
<% elsif adapter == 'postgresql' %>
|
38
35
|
test:
|
39
|
-
|
36
|
+
<<: *default
|
40
37
|
database: <%= db_prefix %>_test
|
41
|
-
|
42
|
-
|
43
|
-
password: <%= db_password %>
|
44
|
-
<% end %>
|
45
|
-
<% unless db_host.blank? %>
|
46
|
-
host: <%= db_host %>
|
47
|
-
<% end %>
|
48
|
-
min_messages: warning
|
49
|
-
<% when 'sqlite' %>
|
38
|
+
|
39
|
+
<% elsif adapter == 'sqlite3' %>
|
50
40
|
test:
|
51
|
-
|
41
|
+
<<: *default
|
52
42
|
database: db/<%= db_prefix %>_test.sqlite3
|
53
43
|
timeout: 10000
|
44
|
+
|
54
45
|
<% end %>
|
@@ -38,10 +38,7 @@ namespace :db do
|
|
38
38
|
# railties:install:migrations and then db:migrate.
|
39
39
|
# Migrations should be run one directory at a time
|
40
40
|
ActiveRecord::Migrator.migrations_paths.each do |path|
|
41
|
-
ActiveRecord::MigrationContext.new(
|
42
|
-
[path],
|
43
|
-
ActiveRecord::SchemaMigration
|
44
|
-
).migrate
|
41
|
+
ActiveRecord::MigrationContext.new([path]).migrate
|
45
42
|
end
|
46
43
|
|
47
44
|
ActiveRecord::Base.clear_cache!
|
@@ -45,6 +45,12 @@ module DummyApp
|
|
45
45
|
|
46
46
|
class Application < ::Rails::Application
|
47
47
|
config.load_defaults("#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}")
|
48
|
+
|
49
|
+
if Rails.gem_version >= Gem::Version.new('7.1')
|
50
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
51
|
+
config.action_dispatch.show_exceptions = :none
|
52
|
+
end
|
53
|
+
|
48
54
|
# Make the test environment more production-like:
|
49
55
|
config.action_controller.allow_forgery_protection = false
|
50
56
|
config.action_controller.default_protect_from_forgery = false
|
@@ -63,7 +69,7 @@ module DummyApp
|
|
63
69
|
|
64
70
|
# Make debugging easier:
|
65
71
|
config.consider_all_requests_local = true
|
66
|
-
config.action_dispatch.show_exceptions = false
|
72
|
+
config.action_dispatch.show_exceptions = false # Should be :none for Rails 7.1+
|
67
73
|
config.active_support.deprecation = :stderr
|
68
74
|
config.log_level = :debug
|
69
75
|
|
@@ -82,22 +88,24 @@ module DummyApp
|
|
82
88
|
config.secret_key_base = 'SECRET_TOKEN'
|
83
89
|
|
84
90
|
# Set the preview path within the dummy app:
|
85
|
-
|
91
|
+
if ActionMailer::Base.respond_to? :preview_paths # Rails 7.1+
|
92
|
+
config.action_mailer.preview_paths << File.expand_path('dummy_app/mailer_previews', __dir__)
|
93
|
+
else
|
94
|
+
config.action_mailer.preview_path = File.expand_path('dummy_app/mailer_previews', __dir__)
|
95
|
+
end
|
86
96
|
|
87
97
|
config.active_record.dump_schema_after_migration = false
|
88
98
|
|
89
99
|
# Configure active storage to use storage within tmp folder
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
root: Rails.root.join('tmp', 'storage')
|
96
|
-
}
|
100
|
+
initializer 'solidus.active_storage' do
|
101
|
+
config.active_storage.service_configurations = {
|
102
|
+
test: {
|
103
|
+
service: 'Disk',
|
104
|
+
root: Rails.root.join('tmp', 'storage')
|
97
105
|
}
|
98
|
-
|
99
|
-
|
100
|
-
|
106
|
+
}
|
107
|
+
config.active_storage.service = :test
|
108
|
+
config.active_storage.variant_processor = ENV.fetch('ACTIVE_STORAGE_VARIANT_PROCESSOR', :vips).to_sym
|
101
109
|
end
|
102
110
|
|
103
111
|
# Avoid issues if an old spec/dummy still exists
|
@@ -117,6 +125,7 @@ module DummyApp
|
|
117
125
|
|
118
126
|
config.assets.paths << File.expand_path('dummy_app/assets/javascripts', __dir__)
|
119
127
|
config.assets.paths << File.expand_path('dummy_app/assets/stylesheets', __dir__)
|
128
|
+
config.assets.css_compressor = nil
|
120
129
|
|
121
130
|
config.paths["config/database"] = File.expand_path('dummy_app/database.yml', __dir__)
|
122
131
|
config.paths['config/routes.rb'] = File.expand_path('dummy_app/routes.rb', __dir__)
|
data/solidus_core.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
actionmailer actionpack actionview activejob activemodel activerecord
|
28
28
|
activestorage activesupport railties
|
29
29
|
].each do |rails_dep|
|
30
|
-
s.add_dependency rails_dep, ['>= 7.0', '< 7.
|
30
|
+
s.add_dependency rails_dep, ['>= 7.0', '< 7.2']
|
31
31
|
end
|
32
32
|
|
33
33
|
s.add_dependency 'activemerchant', '~> 1.66'
|
@@ -43,7 +43,7 @@ Gem::Specification.new do |s|
|
|
43
43
|
s.add_dependency 'monetize', '~> 1.8'
|
44
44
|
s.add_dependency 'kt-paperclip', ['>= 6.3', '< 8']
|
45
45
|
s.add_dependency 'psych', ['>= 4.0.1', '< 5.0']
|
46
|
-
s.add_dependency 'ransack', '~>
|
46
|
+
s.add_dependency 'ransack', '~> 4.0'
|
47
47
|
s.add_dependency 'sprockets-rails'
|
48
48
|
s.add_dependency 'state_machines-activerecord', '~> 0.6'
|
49
49
|
s.add_dependency 'omnes', '~> 0.2.2'
|