require 'rails/generators' module Theme module Generators class ModernBusinessGenerator < ::Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) desc "A Bootstrap HTML starter template (from startbootstrap.com)" def create_page copy_file 'application.html.erb', 'app/views/layouts/application.html.erb' copy_file 'footer.html', 'app/views/layouts/_footer.html.erb' copy_file 'index.html', 'app/views/visitors/index.html.erb' copy_file '404.html', 'app/views/pages/404.html.erb' remove_file 'app/views/pages/about.html.erb' copy_file 'about.html', 'app/views/pages/about.html.erb' copy_file 'blog-home-1.html', 'app/views/pages/blog-home-1.html.erb' copy_file 'blog-home-2.html', 'app/views/pages/blog-home-2.html.erb' copy_file 'blog-post.html', 'app/views/pages/blog-post.html.erb' copy_file 'contact.html', 'app/views/pages/contact.html.erb' copy_file 'faq.html', 'app/views/pages/faq.html.erb' copy_file 'full-width.html', 'app/views/pages/full-width.html.erb' copy_file 'portfolio-1-col.html', 'app/views/pages/portfolio-1-col.html.erb' copy_file 'portfolio-2-col.html', 'app/views/pages/portfolio-2-col.html.erb' copy_file 'portfolio-3-col.html', 'app/views/pages/portfolio-3-col.html.erb' copy_file 'portfolio-4-col.html', 'app/views/pages/portfolio-4-col.html.erb' copy_file 'portfolio-item.html', 'app/views/pages/portfolio-item.html.erb' copy_file 'pricing.html', 'app/views/pages/pricing.html.erb' copy_file 'services.html', 'app/views/pages/services.html.erb' copy_file 'sidebar.html', 'app/views/pages/sidebar.html.erb' copy_file 'modern-business.css', 'app/assets/stylesheets/modern-business.css' inject_into_file 'app/views/layouts/_navigation_links.html.erb', add_links, :after => "page_path('about') %>\n" gsub_file 'app/views/layouts/_navigation.html.erb', /nav navbar-nav/, 'nav navbar-nav navbar-right' end def add_links links = <<-LINKS
  • <%= link_to 'Services', page_path('services') %>
  • <%= link_to 'Contact', page_path('contact') %>
  • LINKS end end end end