Sha256: f3a4e41e6b1ea8a87041fa24c74e3160c941d2549bf414dd30bd8c7e0c93faff
Contents?: true
Size: 961 Bytes
Versions: 19
Compression:
Stored size: 961 Bytes
Contents
require 'rails/generators' module Foundation module Generators class LayoutGenerator < Rails::Generators::Base source_root File.join(File.dirname(__FILE__), 'templates') argument :layout_name, :type => :string, :default => 'application', :banner => 'layout_name' class_option :haml, :desc => 'Generate HAML layout instead of ERB.', :type => :boolean class_option :slim, :desc => 'Generate slim layout instead of ERB.', :type => :boolean def create_layout if options.haml? template 'application.html.haml', "app/views/layouts/#{file_name}.html.haml" elsif options.slim? template 'application.html.slim', "app/views/layouts/#{file_name}.html.slim" else template 'application.html.erb', "app/views/layouts/#{file_name}.html.erb" end end private def file_name layout_name.underscore.downcase end end end end
Version data entries
19 entries across 19 versions & 1 rubygems