Class: SolidusAdmin::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- SolidusAdmin::Generators::InstallGenerator
- Defined in:
- lib/generators/solidus_admin/install/install_generator.rb
Instance Method Summary collapse
- #build_tailwind ⇒ Object
- #copy_initializer ⇒ Object
- #ignore_tailwind_build_files ⇒ Object
- #install_lookbook ⇒ Object
- #install_solidus_core_support ⇒ Object
Instance Method Details
#build_tailwind ⇒ Object
28 29 30 |
# File 'lib/generators/solidus_admin/install/install_generator.rb', line 28 def build_tailwind rake "solidus_admin:tailwindcss:install" if [:tailwind] end |
#copy_initializer ⇒ Object
20 21 22 |
# File 'lib/generators/solidus_admin/install/install_generator.rb', line 20 def copy_initializer template 'config/initializers/solidus_admin.rb.tt', 'config/initializers/solidus_admin.rb' end |
#ignore_tailwind_build_files ⇒ Object
24 25 26 |
# File 'lib/generators/solidus_admin/install/install_generator.rb', line 24 def ignore_tailwind_build_files append_file(".gitignore", "app/assets/builds/solidus_admin/") if File.exist?(Rails.root.join(".gitignore")) end |
#install_lookbook ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/generators/solidus_admin/install/install_generator.rb', line 32 def install_lookbook return unless [:lookbook] gem_group :development, :test do gem "lookbook" gem "listen" gem "actioncable" end execute_command :bundle, :install route "mount Lookbook::Engine, at: '#{solidus_mount_point}lookbook' if Rails.env.development?" end |
#install_solidus_core_support ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/generators/solidus_admin/install/install_generator.rb', line 11 def install_solidus_core_support route <<~RUBY mount SolidusAdmin::Engine, at: '#{solidus_mount_point}admin', constraints: ->(req) { req.cookies['solidus_admin'] != 'false' && req.params['solidus_admin'] != 'false' } RUBY end |