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
- #create_initializer ⇒ Object
- #generate_blank_theme ⇒ Object
- #instructions ⇒ Object
- #migrations ⇒ Object
- #mount_engine ⇒ Object
Instance Method Details
#create_initializer ⇒ Object
14 15 16 17 |
# File 'lib/generators/maglev/install_generator.rb', line 14 def create_initializer directory 'config' directory 'public' end |
#generate_blank_theme ⇒ Object
19 20 21 |
# File 'lib/generators/maglev/install_generator.rb', line 19 def generate_blank_theme generate 'maglev:theme' end |
#instructions ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/generators/maglev/install_generator.rb', line 35 def instructions $stdout.puts <<~INFO Done! 🎉 You can now tweak the settings in `config/initializers/maglev.rb`. You can also modify your theme (`app/theme` and `app/views/theme`) and generate new sections with `rails g maglev:section`. 👉 The next step is to create a site with `rails maglev:create_site`. 🚨 Don't forget to run the last command in production as well! INFO end |
#migrations ⇒ Object
9 10 11 12 |
# File 'lib/generators/maglev/install_generator.rb', line 9 def migrations rake 'maglev:install:migrations' rake 'db:migrate' end |
#mount_engine ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/generators/maglev/install_generator.rb', line 23 def mount_engine inject_into_file 'config/routes.rb', before: /^end/ do <<-CODE # Mount Maglev engine (mainly used for the content editor) mount Maglev::Engine => '/maglev' # Handle "/:path" + "/sitemap" requests by Maglev engine draw 'maglev/public_preview' CODE end end |