Sha256: 4250f21781505e90f2cf44b0a3e0f878c73199ebdd5f4827019ea3d126cfa9b8

Contents?: true

Size: 641 Bytes

Versions: 7

Compression:

Stored size: 641 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

        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

7 entries across 7 versions & 1 rubygems

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