Class: Maquina::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Maquina::InstallGenerator
- Defined in:
- lib/generators/maquina/install_generator.rb
Instance Method Summary collapse
- #add_concerns ⇒ Object
- #add_route ⇒ Object
- #copy_migrations ⇒ Object
- #create_initializer_file ⇒ Object
Instance Method Details
#add_concerns ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/generators/maquina/install_generator.rb', line 16 def add_concerns inject_into_file "app/controllers/application_controller.rb", after: "ActionController::Base" do <<~EOF \n include Maquina::Authenticate EOF end end |
#add_route ⇒ Object
11 12 13 14 |
# File 'lib/generators/maquina/install_generator.rb', line 11 def add_route return if Rails.application.routes.routes.detect { |route| route.app.app == Maquina::Engine } route %(mount Maquina::Engine => "/m") end |
#copy_migrations ⇒ Object
24 25 26 |
# File 'lib/generators/maquina/install_generator.rb', line 24 def copy_migrations rake "maquina:install:migrations" end |
#create_initializer_file ⇒ Object
7 8 9 |
# File 'lib/generators/maquina/install_generator.rb', line 7 def create_initializer_file template "config/initializers/maquina.rb" end |