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

Version Path
zurb-foundation-2.2.1.2 lib/foundation/generators/layout_generator.rb
zurb-foundation-2.2.1.1 lib/foundation/generators/layout_generator.rb
zurb-foundation-2.2.1.0 lib/foundation/generators/layout_generator.rb
zurb-foundation-2.2.0.2 lib/foundation/generators/layout_generator.rb
zurb-foundation-2.2.0.1 lib/foundation/generators/layout_generator.rb
zurb-foundation-2.1.5.1 lib/foundation/generators/layout_generator.rb
zurb-foundation-2.1.5.0 lib/foundation/generators/layout_generator.rb
zurb-foundation-2.1.4.3 lib/foundation/generators/layout_generator.rb
zurb-foundation-2.1.4.2 lib/foundation/generators/layout_generator.rb
zurb-foundation-2.1.4.1 lib/foundation/generators/layout_generator.rb
zurb-foundation-2.1.4 lib/foundation/generators/layout_generator.rb
zurb-foundation-2.1.3.1 lib/foundation/generators/layout_generator.rb
zurb-foundation-2.1.3 lib/foundation/generators/layout_generator.rb
zurb-foundation-2.1.2 lib/foundation/generators/layout_generator.rb
zurb-foundation-2.1.0 lib/foundation/generators/layout_generator.rb
zurb-foundation-2.0.3.3 lib/foundation/generators/layout_generator.rb
zurb-foundation-2.0.3.2 lib/foundation/generators/layout_generator.rb
zurb-foundation-2.0.3.1 lib/foundation/generators/layout_generator.rb
zurb-foundation-2.0.2 lib/foundation/generators/layout_generator.rb