solidus_core 3.2.2 → 3.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 544b2bfea9af16a2ae309c6eb5b4d2038b60cf592b461b9019d66933324cbab8
4
- data.tar.gz: 36312a6f1b0b979c06e68125199834650b0f5fea1ee65af092136527b4121978
3
+ metadata.gz: dc968f634c0e31f7ad3d1928133d5d682df2669617eaca7abdc87379228d7e30
4
+ data.tar.gz: a2e38014e3d24fe363651e7e27f5b8fa21b93105f1269e67adee3e20ec1665fa
5
5
  SHA512:
6
- metadata.gz: 4c5bbfc5dacae815c6ce863d2c807d2a4e49c448912f3c8e9f5e8901b5aa1b1c2e8d3bdeeea3ea3e76d116b66e6aa6e9eba307471023f44ed61806eaa3b662c6
7
- data.tar.gz: 816d06788b22c4fe4b02780e0d640ba8f56a0186371ddbcf2e40cac9695a4f697e3a131cbc6d893321e42c741f27d63c48e7ce604958da5ed37957db451a5bfc
6
+ metadata.gz: 8fbc377c572b99bb42d055b1479f2be9c5bca450019f70bef38adf76a3bfd69057c90824150036c7ed1330d9052f3916f09a48a252b85f31c0719f33f5d52c43
7
+ data.tar.gz: c57b6889ddf53bcf23fc1ed0012a9759ef72a031a72e1c8a8a838abfb8594b8f401bb17a973d17c37347aae44f37411181ab9a663e884659ebeb6122c06481c4
@@ -11,42 +11,48 @@ module Solidus
11
11
  @generator_context = generator_context
12
12
  end
13
13
 
14
- def call(frontend, installer_adds_auth:)
14
+ def call(frontend)
15
15
  case frontend
16
16
  when 'solidus_frontend'
17
17
  install_solidus_frontend
18
18
  when 'solidus_starter_frontend'
19
- install_solidus_starter_frontend(installer_adds_auth)
19
+ install_solidus_starter_frontend
20
20
  end
21
21
  end
22
22
 
23
23
  private
24
24
 
25
- def install_solidus_frontend
26
- unless @bundler_context.component_in_gemfile?(:frontend)
27
- BundlerContext.bundle_cleanly do
28
- `bundle add solidus_frontend`
29
- `bundle install`
30
- end
31
- end
25
+ def bundle_command(command)
26
+ @generator_context.say_status :run, "bundle #{command}"
27
+ bundle_path = Gem.bin_path("bundler", "bundle")
32
28
 
33
- @generator_context.generate("solidus_frontend:install #{@generator_context.options[:auto_accept] ? '--auto-accept' : ''}")
29
+ BundlerContext.bundle_cleanly do
30
+ system(
31
+ Gem.ruby,
32
+ bundle_path,
33
+ *command.shellsplit,
34
+ )
35
+ end
34
36
  end
35
37
 
36
- def install_solidus_starter_frontend(installer_adds_auth)
37
- @bundler_context.remove(['solidus_frontend']) if @bundler_context.component_in_gemfile?(:frontend)
38
+ def install_solidus_frontend
39
+ unless @bundler_context.component_in_gemfile?(:frontend)
40
+ bundle_command 'add solidus_frontend'
41
+ end
38
42
 
39
- # TODO: Move installation of solidus_auth_devise to the
40
- # solidus_starter_frontend template
41
- unless auth_present?(installer_adds_auth)
42
- BundlerContext.bundle_cleanly { `bundle add solidus_auth_devise` }
43
- @generator_context.generate('solidus:auth:install --auto-run-migrations')
43
+ # Solidus bolt will be handled in the installer as a payment method.
44
+ begin
45
+ skip_solidus_bolt = ENV['SKIP_SOLIDUS_BOLT']
46
+ ENV['SKIP_SOLIDUS_BOLT'] = 'true'
47
+ @generator_context.generate("solidus_frontend:install #{@generator_context.options[:auto_accept] ? '--auto-accept' : ''}")
48
+ ensure
49
+ ENV['SKIP_SOLIDUS_BOLT'] = skip_solidus_bolt
44
50
  end
45
- `LOCATION="https://raw.githubusercontent.com/solidusio/solidus_starter_frontend/main/template.rb" bin/rails app:template`
46
51
  end
47
52
 
48
- def auth_present?(installer_adds_auth)
49
- installer_adds_auth || @bundler_context.component_in_gemfile?(:auth_devise)
53
+ def install_solidus_starter_frontend
54
+ @bundler_context.remove(['solidus_frontend']) if @bundler_context.component_in_gemfile?(:frontend)
55
+ @generator_context.apply "https://raw.githubusercontent.com/solidusio/solidus_starter_frontend/v3.2/template.rb"
50
56
  end
51
57
  end
52
58
  end
@@ -19,6 +19,12 @@ module Solidus
19
19
  'none'
20
20
  ].freeze
21
21
 
22
+ PAYMENT_METHODS = {
23
+ 'paypal' => 'solidus_paypal_commerce_platform',
24
+ 'bolt' => 'solidus_bolt',
25
+ 'none' => nil,
26
+ }
27
+
22
28
  class_option :migrate, type: :boolean, default: true, banner: 'Run Solidus migrations'
23
29
  class_option :seed, type: :boolean, default: true, banner: 'Load seed data (migrations must be run)'
24
30
  class_option :sample, type: :boolean, default: true, banner: 'Load sample data (migrations must be run)'
@@ -28,13 +34,18 @@ module Solidus
28
34
  class_option :admin_email, type: :string
29
35
  class_option :admin_password, type: :string
30
36
  class_option :lib_name, type: :string, default: 'spree'
31
- class_option :with_authentication, type: :boolean, default: true
37
+ class_option :with_authentication, type: :boolean, default: nil
32
38
  class_option :enforce_available_locales, type: :boolean, default: nil
33
39
  class_option :frontend,
34
40
  type: :string,
35
41
  enum: FRONTENDS,
36
42
  default: nil,
37
43
  desc: "Indicates which frontend to install."
44
+ class_option :payment_method,
45
+ type: :string,
46
+ enum: PAYMENT_METHODS.keys,
47
+ default: nil,
48
+ desc: "Indicates which payment method to install."
38
49
 
39
50
  def self.source_paths
40
51
  paths = superclass.source_paths
@@ -118,7 +129,8 @@ module Solidus
118
129
  end
119
130
 
120
131
  def install_auth_plugin
121
- if options[:with_authentication] && (options[:auto_accept] || !no?("
132
+ with_authentication = options[:with_authentication]
133
+ with_authentication.nil? and with_authentication = (options[:auto_accept] || !no?("
122
134
  Solidus has a default authentication extension that uses Devise.
123
135
  You can find more info at https://github.com/solidusio/solidus_auth_devise.
124
136
 
@@ -127,11 +139,32 @@ module Solidus
127
139
 
128
140
  Would you like to install it? (Y/n)"))
129
141
 
142
+ if with_authentication
130
143
  @plugins_to_be_installed << 'solidus_auth_devise'
131
144
  @plugin_generators_to_run << 'solidus:auth:install'
132
145
  end
133
146
  end
134
147
 
148
+ def install_payment_method
149
+ say_status :warning, set_color(
150
+ "Selecting a payment along with `solidus_starter_frontend` might require manual integration.",
151
+ :yellow
152
+ ), :yellow
153
+
154
+ name = options[:payment_method]
155
+ name ||= PAYMENT_METHODS.keys.first if options[:auto_accept]
156
+ name ||= ask("
157
+ You can select a payment method to be included in the installation process.
158
+ Please select a payment method name:", limited_to: PAYMENT_METHODS.keys, default: PAYMENT_METHODS.keys.first)
159
+
160
+ gem_name = PAYMENT_METHODS.fetch(name)
161
+
162
+ if gem_name
163
+ @plugins_to_be_installed << gem_name
164
+ @plugin_generators_to_run << "#{gem_name}:install"
165
+ end
166
+ end
167
+
135
168
  def include_seed_data
136
169
  append_file "db/seeds.rb", <<-RUBY.strip_heredoc
137
170
 
@@ -150,19 +183,6 @@ module Solidus
150
183
  rake 'db:create'
151
184
  end
152
185
 
153
- def run_bundle_install_if_needed_by_plugins
154
- @plugins_to_be_installed.each do |plugin_name|
155
- gem plugin_name
156
- end
157
-
158
- BundlerContext.bundle_cleanly { run "bundle install" } if @plugins_to_be_installed.any?
159
- run "spring stop" if defined?(Spring)
160
-
161
- @plugin_generators_to_run.each do |plugin_generator_name|
162
- generate "#{plugin_generator_name} --skip_migrations=true"
163
- end
164
- end
165
-
166
186
  def install_frontend
167
187
  return if options[:frontend] == 'none'
168
188
 
@@ -174,9 +194,22 @@ module Solidus
174
194
 
175
195
  say_status :installing, frontend
176
196
 
177
- InstallFrontend.
178
- new(bundler_context: bundler_context, generator_context: self).
179
- call(frontend, installer_adds_auth: @plugins_to_be_installed.include?('solidus_auth_devise'))
197
+ InstallFrontend
198
+ .new(bundler_context: bundler_context, generator_context: self)
199
+ .call(frontend)
200
+ end
201
+
202
+ def run_bundle_install_if_needed_by_plugins
203
+ @plugins_to_be_installed.each do |plugin_name|
204
+ gem plugin_name
205
+ end
206
+
207
+ BundlerContext.bundle_cleanly { run "bundle install" } if @plugins_to_be_installed.any?
208
+ run "spring stop" if defined?(Spring)
209
+
210
+ @plugin_generators_to_run.each do |plugin_generator_name|
211
+ generate "#{plugin_generator_name} --skip_migrations=true"
212
+ end
180
213
  end
181
214
 
182
215
  def run_migrations
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spree
4
- VERSION = "3.2.2"
4
+ VERSION = "3.2.3"
5
5
 
6
6
  def self.solidus_version
7
7
  VERSION
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.2
4
+ version: 3.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-09 00:00:00.000000000 Z
11
+ date: 2022-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer