Class: Theme::Generators::CleanBlogGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/theme/clean_blog/clean_blog_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_pageObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/generators/theme/clean_blog/clean_blog_generator.rb', line 10

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 '_navigation.html.erb', 'app/views/layouts/_navigation.html.erb'
  copy_file '_navigation_links.html.erb', 'app/views/layouts/_navigation_links.html.erb'
  copy_file 'index.html', 'app/views/visitors/index.html.erb'
  copy_file 'about.html', 'app/views/pages/about.html.erb'
  copy_file 'contact.html', 'app/views/pages/contact.html.erb'
  copy_file 'post.html', 'app/views/pages/post.html.erb'
  copy_file 'clean-blog.css', 'app/assets/stylesheets/clean-blog.css'
end


22
23
24
25
26
# File 'lib/generators/theme/clean_blog/clean_blog_generator.rb', line 22

def modify_layout_for_auth_links
  return unless File.exists?('app/views/layouts/_nav_links_for_auth.html.erb')
  partial = "<%= render 'layouts/navigation_links' %>\n        <%= render 'layouts/nav_links_for_auth' %>"
  gsub_file "app/views/layouts/_navigation.html.erb", /<%= render 'layouts\/navigation_links' %>/, partial
end