class Bootstrap::Layout::GeneratorBase
Attributes
app_name[RW]
body[RW]
style[RW]
Public Instance Methods
create_layout()
click to toggle source
# File lib/generators/bootstrap/layout/generator_base.rb, line 11 def create_layout # Heavily from twitter-bootstrap-rails app = ::Rails.application self.app_name = app.class.to_s.split("::").first layout_name = self.class.name.chomp("Generator").demodulize.underscore engine = options[:template_engine] || :erb context = instance_eval('binding') self.style = ERB.new(::File.new(::File.expand_path(find_in_source_paths("#{layout_name}.css"))).read).result(context) self.body = ERB.new(::File.new(::File.expand_path(find_in_source_paths("#{layout_name}.html.#{engine}"))).read).result(context) remove_file "app/views/layouts/application.html.erb" remove_file "app/views/layouts/application.html.haml" template "base.html.#{engine}", "app/views/layouts/application.html.#{engine}" remove_file "public/index.html" copy_file "_nav.html.#{engine}", "app/views/shared/_nav.html.#{engine}" copy_file "_nav_second_tier.html.#{engine}", "app/views/shared/_nav_second_tier.html.#{engine}" if nav_second_tier copy_file "home_controller.rb.erb", "app/controllers/home_controller.rb" template "index.html.#{engine}", "app/views/home/index.html.#{engine}" end
routes()
click to toggle source
# File lib/generators/bootstrap/layout/generator_base.rb, line 32 def routes route 'root :to => "home#index"' end