Sha256: 31f46b6aecdf5fc1e884288c5d6b1ebc0cad18c66098e183226c60a3e998c1fe

Contents?: true

Size: 671 Bytes

Versions: 2

Compression:

Stored size: 671 Bytes

Contents

# frozen_string_literal: true

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_extension] || :erb
        template "layout.html.#{ext}", "app/views/layouts/#{layout_name}.html.#{ext}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
railsstrap-4.0.0.beta3 lib/generators/railsstrap/layout/layout_generator.rb
railsstrap-4.0.0.beta2 lib/generators/railsstrap/layout/layout_generator.rb