Sha256: 820a92eaa52d1af2dba33d7a07f5c99a49835dbe2b22a329014821655188bc27

Contents?: true

Size: 643 Bytes

Versions: 6

Compression:

Stored size: 643 Bytes

Contents

require 'rails/generators'

module Railsstrap
  module Generators
    class LayoutGenerator < ::Rails::Generators::Base
      source_root File.expand_path('../templates', __FILE__)
      desc 'Generates a layout file with navigation.'
      argument :layout_name, :type => :string, :default => 'application'

      attr_reader :app_name

      def generate_layout
        app = ::Rails.application
        @app_name = app.class.to_s.split('::').first
        ext = app.config.generators.options[:rails][:template_engine] || :erb
        template "layout.html.#{ext}", "app/views/layouts/#{layout_name}.html.#{ext}"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
railsstrap-3.3.4 lib/generators/railsstrap/layout/layout_generator.rb
railsstrap-3.3.2 lib/generators/railsstrap/layout/layout_generator.rb
railsstrap-3.3.1 lib/generators/railsstrap/layout/layout_generator.rb
railsstrap-3.3.0 lib/generators/railsstrap/layout/layout_generator.rb
railsstrap-3.2.0.3 lib/generators/railsstrap/layout/layout_generator.rb
railsstrap-3.2.0.2 lib/generators/railsstrap/layout/layout_generator.rb