Sha256: dd4acefa92e7ca72b84e14ed3e36fc8e1f602d4762e17cc5cbeb778772013ccb
Contents?: true
Size: 789 Bytes
Versions: 14
Compression:
Stored size: 789 Bytes
Contents
require 'rails/generators' module Pages module Generators class HomeGenerator < ::Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) desc "Create a home page" 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 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 end end end
Version data entries
14 entries across 14 versions & 1 rubygems