Class: Panel::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_routeObject



6
7
8
9
10
# File 'lib/generators/panel/install_generator.rb', line 6

def add_route
  insert_into_file 'config/routes.rb', after: /(.*)::Application.routes.draw do/ do |match|
    "#{match}\n\n  namespace :panel do\n    root to: 'pages#index'\n  end"
  end
end

#add_templatesObject



12
13
14
15
16
17
# File 'lib/generators/panel/install_generator.rb', line 12

def add_templates
  template 'install/base_controller.rb', 'app/controllers/panel/base_controller.rb'
  template 'install/pages_controller.rb', 'app/controllers/panel/pages_controller.rb'
  template 'install/index.html.erb', 'app/views/panel/pages/index.html.erb'
  copy_file 'install/panel.html.erb', 'app/views/layouts/panel.html.erb'
end