Sha256: 4c4c3f1b3f959dafdcd6e4aa5a82a662b95618b8c5891e80722526e8f65b537e

Contents?: true

Size: 849 Bytes

Versions: 11

Compression:

Stored size: 849 Bytes

Contents

require 'rails/generators'

module Groundworkcss
  module Generators
    class LayoutGenerator < ::Rails::Generators::Base
      source_root File.expand_path("../templates", __FILE__)
      desc "This generator generates layout file with navigation."
      argument :layout_name, :type => :string, :default => "application"
      attr_reader :app_name, :container_class

      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}"
        copy_file "_sidebar.html.#{ext}", "app/views/layouts/_sidebar.html.#{ext}"
        copy_file "_header.html.#{ext}", "app/views/layouts/_sidebar.html.#{ext}"        
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
groundworkcss-rails-0.2.12 lib/generators/groundworkcss/layout/layout_generator.rb~
groundworkcss-rails-0.2.11 lib/generators/groundworkcss/layout/layout_generator.rb~
groundworkcss-rails-0.2.10 lib/generators/groundworkcss/layout/layout_generator.rb~
groundworkcss-rails-0.2.9 lib/generators/groundworkcss/layout/layout_generator.rb~
groundworkcss-rails-0.2.8 lib/generators/groundworkcss/layout/layout_generator.rb~
groundworkcss-rails-0.2.7 lib/generators/groundworkcss/layout/layout_generator.rb~
groundworkcss-rails-0.2.6 lib/generators/groundworkcss/layout/layout_generator.rb~
groundworkcss-rails-0.2.5 lib/generators/groundworkcss/layout/layout_generator.rb~
groundworkcss-rails-0.2.2 lib/generators/groundworkcss/layout/layout_generator.rb~
groundworkcss-rails-0.2 lib/generators/groundworkcss/layout/layout_generator.rb~
groundworkcss-rails-0.1 lib/generators/groundworkcss/layout/layout_generator.rb~