Sha256: 32d107a98c22c49f0db469ceba222af01e93c1858a13bf146eb192ef1680f26b

Contents?: true

Size: 730 Bytes

Versions: 10

Compression:

Stored size: 730 Bytes

Contents

require 'rails/generators/joosy/joosy_base'

module Joosy
  module Generators
    class LayoutGenerator < ::Rails::Generators::JoosyBase
      source_root File.join(File.dirname(__FILE__), 'templates')

      def create_files
        super

        template "app/layouts/template.js.coffee", "#{app_path}/layouts/#{file_name}.js.coffee"

        create_file("#{app_path}/templates/layouts/#{file_name}.jst.#{options[:template_kind]}")
      end

      protected

      def app_path
        unless class_path.size == 1
          puts <<HELP
Usage: rails generate joosy:layout joosy_app_name/layout_name
Tip: do not add Layout suffix to layout_name
HELP
          exit 1
        end
        class_path[0]
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
joosy-1.1.2 lib/rails/generators/joosy/layout_generator.rb
joosy-1.1.1 lib/rails/generators/joosy/layout_generator.rb
joosy-1.1.0 lib/rails/generators/joosy/layout_generator.rb
joosy-1.1.0.alpha.3 lib/rails/generators/joosy/layout_generator.rb
joosy-1.1.0.alpha.2 lib/rails/generators/joosy/layout_generator.rb
joosy-1.1.0.alpha.1 lib/rails/generators/joosy/layout_generator.rb
joosy-1.0.0.RC7 lib/rails/generators/joosy/layout_generator.rb
joosy-1.0.0.RC6 lib/rails/generators/joosy/layout_generator.rb
joosy-1.0.0.RC5 lib/rails/generators/joosy/layout_generator.rb
joosy-1.0.0.RC4 lib/rails/generators/joosy/layout_generator.rb