Class: Maglev::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Maglev::InstallGenerator
- Defined in:
- lib/generators/maglev/install_generator.rb
Instance Method Summary collapse
- #compile_editor_assets ⇒ Object
- #create_initializer ⇒ Object
- #generate_blank_theme ⇒ Object
- #instructions ⇒ Object
- #migrations ⇒ Object
- #mount_engine ⇒ Object
Instance Method Details
#compile_editor_assets ⇒ Object
9 10 11 12 |
# File 'lib/generators/maglev/install_generator.rb', line 9 def compile_editor_assets rake 'maglev:vite:install_dependencies' rake 'maglev:vite:build_all' end |
#create_initializer ⇒ Object
19 20 21 22 |
# File 'lib/generators/maglev/install_generator.rb', line 19 def create_initializer directory 'config' directory 'public' end |
#generate_blank_theme ⇒ Object
24 25 26 |
# File 'lib/generators/maglev/install_generator.rb', line 24 def generate_blank_theme generate 'maglev:theme' end |
#instructions ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/generators/maglev/install_generator.rb', line 38 def instructions $stdout.puts <<~INFO Done! 🎉 You can now tweak config/initializers/maglev.rb You can also modify your theme (in app/theme and app/views/theme) and generate new sections with rails g maglev:section. 👉 The next step is to create a site using `rails maglev:create_site`. 🚨 Don't forget to do it in production as well! INFO end |
#migrations ⇒ Object
14 15 16 17 |
# File 'lib/generators/maglev/install_generator.rb', line 14 def migrations rake 'maglev:install:migrations' rake 'db:migrate' end |
#mount_engine ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/generators/maglev/install_generator.rb', line 28 def mount_engine inject_into_file 'config/routes.rb', before: /^end/ do <<-CODE mount Maglev::Engine => '/maglev' get '/sitemap', to: 'maglev/sitemap#index', defaults: { format: 'xml' } get '(*path)', to: 'maglev/page_preview#index', defaults: { path: 'index' }, constraints: Maglev::PreviewConstraint.new CODE end end |