Sha256: 289ed0002ac05b6e9ea015c7ee91c0366ad8911f97a85e7ab28040bff01141fd

Contents?: true

Size: 1.41 KB

Versions: 3

Compression:

Stored size: 1.41 KB

Contents

require 'generators/seivan'

module Seivan
  module Generators
    class Html5Generator < Base
      argument :layout_name, :type => :string, :default => 'application', :banner => 'layout_name'

      class_option :haml, :desc => 'Generate HAML for view, and SASS for stylesheet.', :type => :boolean

      def create_layout
        if options.haml?
          template "application.html.haml", "app/views/layouts/#{file_name}.html.haml"
          template "_head.html.haml", "app/views/layouts/_head.html.haml"
          template "_header.html.haml", "app/views/layouts/_header.html.haml"
          template "_flashes.html.haml", "app/views/layouts/_flashes.html.haml"
          template "_footer.html.haml", "app/views/layouts/_footer.html.haml"
          template "_javascripts.html.haml", "app/views/layouts/_javascripts.html.haml"
          template "_stylesheets.html.haml", "app/views/layouts/_stylesheets.html.haml"
          template "_errors.html.haml", "app/views/shared/_errors.html.haml"
          template "jquery.js", "public/javascripts/jquery.js"
          template "jquery_ujs.js", "public/javascripts/jquery_ujs.js"
          template "layout_helper.rb", "app/helpers/layout_helper.rb"
          inject_into_class "app/controllers/application_controller.rb", "ApplicationController", "  helper :layout\n"
        end
      end

      private

      def file_name
        layout_name.underscore
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
seivan-generators-0.5 lib/generators/seivan/html5/html5_generator.rb
seivan-generators-0.4 lib/generators/seivan/html5/html5_generator.rb
seivan-generators-0.3 lib/generators/seivan/html5/html5_generator.rb