Class: Maquina::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/maquina/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_concernsObject



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_routeObject



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_migrationsObject



24
25
26
# File 'lib/generators/maquina/install_generator.rb', line 24

def copy_migrations
  rake "maquina:install:migrations"
end

#create_initializer_fileObject



7
8
9
# File 'lib/generators/maquina/install_generator.rb', line 7

def create_initializer_file
  template "config/initializers/maquina.rb"
end