Skip to content

Commit 369331f

Browse files
Allow for starter_frontend rename
The changes here won't necessarily be merged at the exact same time as the other changes to solidus_storefront/starter_frontend so I made this all work with either name.
1 parent e237ab1 commit 369331f

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

lib/generators/solidus_paypal_commerce_platform/install/install_generator.rb

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class InstallGenerator < Rails::Generators::Base
1616
def normalize_components_options
1717
@components = {
1818
backend: options[:backend],
19-
starter_frontend: options[:frontend] == 'starter',
19+
storefront: options[:frontend] == 'starter' || options[:frontend] == 'storefront',
2020
classic_frontend: options[:frontend] == 'classic',
2121
}
2222
end
@@ -43,15 +43,21 @@ def install_solidus_backend_support
4343
end
4444
end
4545

46-
def install_solidus_starter_frontend_support
47-
support_code_for(:starter_frontend) do
46+
def install_solidus_storefront_support
47+
support_code_for(:storefront) do
4848
directory 'app', 'app'
49+
js_manifest = File.exist?('app/assets/javascripts/solidus_storefront.js') ?
50+
'app/assets/javascripts/solidus_storefront.js' :
51+
'app/assets/javascripts/solidus_starter_frontend.js'
52+
css_manifest = File.exist?('app/assets/stylesheets/solidus_storefront.css') ?
53+
'app/assets/stylesheets/solidus_storefront.css' :
54+
'app/assets/stylesheets/solidus_starter_frontend.css'
4955
append_file(
50-
'app/assets/javascripts/solidus_starter_frontend.js',
56+
js_manifest,
5157
"//= require spree/frontend/solidus_paypal_commerce_platform\n"
5258
)
5359
inject_into_file(
54-
'app/assets/stylesheets/solidus_starter_frontend.css',
60+
css_manifest,
5561
" *= require spree/frontend/solidus_paypal_commerce_platform\n",
5662
before: %r{\*/},
5763
verbose: true,
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# frozen_string_literal: true
22

3-
require 'solidus_starter_frontend_spec_helper'
3+
begin
4+
require 'solidus_storefront_spec_helper'
5+
rescue LoadError
6+
require 'solidus_starter_frontend_spec_helper'
7+
end
48

59
Dir["#{__dir__}/support/solidus_paypal_commerce_platform/**/*.rb"].sort.each { |f| require f }

0 commit comments

Comments
 (0)