Sha256: cb025a20f5a8d977f6972a4cffc611a02b655436103276892bf15f70d87ffa46

Contents?: true

Size: 582 Bytes

Versions: 5

Compression:

Stored size: 582 Bytes

Contents

module Rails
  module Generators
    class DecoratorGenerator < Rails::Generators::NamedBase
      source_root File.expand_path('../templates', __FILE__)

      desc <<DESC
Description:
    Stubs out a decorator module in app/decorators directory.

Examples:
    `rails g decorator book`

    This creates:
        app/decorators/book_decorator.rb
DESC

      def create_decorator_file
        empty_directory 'app/decorators'

        template 'decorator.rb', File.join('app/decorators', "#{singular_name}_decorator.rb")
      end

      hook_for :test_framework
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_decorator-0.3.1 lib/generators/rails/decorator_generator.rb
active_decorator-0.3.0 lib/generators/rails/decorator_generator.rb
active_decorator-0.2.1 lib/generators/rails/decorator_generator.rb
active_decorator-0.2.0 lib/generators/rails/decorator_generator.rb
active_decorator-0.1.0 lib/generators/rails/decorator_generator.rb