Class: Pages::Generators::HomeGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Pages::Generators::HomeGenerator
- Defined in:
- lib/generators/pages/home/home_generator.rb
Instance Method Summary collapse
Instance Method Details
#add_tests ⇒ Object
18 19 20 21 |
# File 'lib/generators/pages/home/home_generator.rb', line 18 def add_tests return unless File.exists?('spec/spec_helper.rb') copy_file 'home_page_spec.rb', 'spec/features/visitors/home_page_spec.rb' end |
#create_page ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/generators/pages/home/home_generator.rb', line 10 def create_page return if File.exists?('app/views/visitors/index.html.erb') copy_file 'index.html.erb', 'app/views/visitors/index.html.erb' copy_file 'visitors_controller.rb', 'app/controllers/visitors_controller.rb' route = " root to: 'visitors#index'" inject_into_file 'config/routes.rb', route + "\n", :after => "routes.draw do\n" end |