Class: SolidusFrontend::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- SolidusFrontend::Generators::InstallGenerator
- Defined in:
- lib/generators/solidus_frontend/install/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #copy_initializer ⇒ Object
- #install_solidus_bolt ⇒ Object
- #robots_directives ⇒ Object
- #setup_assets ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
10 11 12 |
# File 'lib/generators/solidus_frontend/install/install_generator.rb', line 10 def self.exit_on_failure? true end |
Instance Method Details
#copy_initializer ⇒ Object
14 15 16 |
# File 'lib/generators/solidus_frontend/install/install_generator.rb', line 14 def copy_initializer template 'initializer.rb', 'config/initializers/solidus_frontend.rb' end |
#install_solidus_bolt ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/generators/solidus_frontend/install/install_generator.rb', line 43 def install_solidus_bolt return if ENV['SKIP_SOLIDUS_BOLT'] || !File.exist?('Gemfile') || !([:auto_accept] || yes?(<<~MSG)) Would you like to add bolt (https://www.bolt.com) as a default payment method? If you answer yes, solidus_bolt (https://github.com/solidusio/solidus_bolt) will be added to the installation (y/n): MSG gem 'solidus_bolt' bundle_cleanly { `bundle` } generate 'solidus_bolt:install --auto-run-migrations' end |
#robots_directives ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/generators/solidus_frontend/install/install_generator.rb', line 18 def robots_directives FileUtils.touch "public/robots.txt" append_file "public/robots.txt", <<-ROBOTS.strip_heredoc User-agent: * Disallow: /checkout Disallow: /cart Disallow: /orders Disallow: /user Disallow: /account Disallow: /api Disallow: /password ROBOTS end |
#setup_assets ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/generators/solidus_frontend/install/install_generator.rb', line 32 def setup_assets empty_directory 'app/assets/images' %w{javascripts stylesheets images}.each do |path| empty_directory "vendor/assets/#{path}/spree/frontend" end template "vendor/assets/javascripts/spree/frontend/all.js" template "vendor/assets/stylesheets/spree/frontend/all.css" end |