Sha256: 92c665bbf819c370619068fe7daeaa57de215a94e2cea7090709c3e06d0b0f3f

Contents?: true

Size: 713 Bytes

Versions: 18

Compression:

Stored size: 713 Bytes

Contents

module Rails
  module Generators
    class LayoutGenerator < Base
      desc "Generates layouts for your application."
      source_root File.expand_path('../templates', __FILE__)
      argument :layout_name, :type => :string, :default => 'application'
      argument :markup,      :type => :string, :default => 'erb'

      def generate_layout
        template "layout.html.#{extension}", "app/views/layouts/#{file_name}.html.#{extension}"
      end
     
    private

      def file_name
        layout_name.underscore
      end

      def extension
        extension = markup.downcase
        extension = 'erb' unless ['erb', 'haml', 'slim'].include?(extension)
        extension
      end
    end
  end
end  

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
playmo-0.1.10 lib/generators/rails/layout_generator.rb
playmo-0.1.9 lib/generators/rails/layout_generator.rb
playmo-0.1.8 lib/generators/rails/layout_generator.rb
playmo-0.1.7 lib/generators/rails/layout_generator.rb
playmo-0.1.6 lib/generators/rails/layout_generator.rb
playmo-0.1.5 lib/generators/rails/layout_generator.rb
playmo-0.1.4 lib/generators/rails/layout_generator.rb
playmo-0.1.3 lib/generators/rails/layout_generator.rb
playmo-0.1.2 lib/generators/rails/layout_generator.rb
playmo-0.1.1 lib/generators/rails/layout_generator.rb
playmo-0.1.0 lib/generators/rails/layout_generator.rb
playmo-0.0.18 lib/generators/rails/layout_generator.rb
playmo-0.0.17 lib/generators/rails/layout_generator.rb
playmo-0.0.14 lib/generators/rails/layout_generator.rb
playmo-0.0.13 lib/generators/rails/layout_generator.rb
playmo-0.0.12 lib/generators/rails/layout_generator.rb
playmo-0.0.11 lib/generators/rails/layout_generator.rb
playmo-0.0.10 lib/generators/rails/layout_generator.rb