Sha256: 283cf4fd7cb00758ce53513de1fe79d3c7c347d87985d5706eb9c5af0372e156

Contents?: true

Size: 689 Bytes

Versions: 6

Compression:

Stored size: 689 Bytes

Contents

require 'rails/generators/joosy/joosy_base'

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

      def create_files
        super

        empty_directory "#{app_path}/resources"
        template "app/resources/template.js.coffee", "#{app_path}/resources/#{file_name}.js.coffee"
      end

      protected

      def app_path
        unless class_path.size == 1
          puts <<HELP
Usage: rails generate joosy:resource joosy_app_name/resource_name
Tip: resource_name is better to be singular
HELP
          exit 1
        end
        class_path[0]
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
joosy-1.0.0.RC3 lib/rails/generators/joosy/resource_generator.rb
joosy-1.0.0.RC2 lib/rails/generators/joosy/resource_generator.rb
joosy-1.0.0.RC1 lib/rails/generators/joosy/resource_generator.rb
joosy-0.1.0.RC3 lib/rails/generators/joosy/resource_generator.rb
joosy-0.1.0.RC2 lib/rails/generators/joosy/resource_generator.rb
joosy-0.1.0.RC1 lib/rails/generators/joosy/resource_generator.rb