Sha256: 21631e4e93991ce63dfaed8ed280dfde6ddfca4d138560e4eef17cc805d7c1c5

Contents?: true

Size: 616 Bytes

Versions: 7

Compression:

Stored size: 616 Bytes

Contents

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

    DECORATORS_ROOT = 'app/decorators/'
    APPLICATION_DECORATOR = 'application_decorator.rb'
    APPLICATION_DECORATOR_PATH = DECORATORS_ROOT + APPLICATION_DECORATOR

    def build_model_and_application_decorators
      empty_directory "app/decorators"
      unless File.exists?(APPLICATION_DECORATOR_PATH)
        template APPLICATION_DECORATOR, APPLICATION_DECORATOR_PATH
      end
      template 'decorator.rb', "#{DECORATORS_ROOT}#{singular_name}_decorator.rb"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
draper-0.8.1 lib/generators/draper/decorator/decorator_generator.rb
draper-0.8.0 lib/generators/draper/decorator/decorator_generator.rb
draper-0.7.4 lib/generators/draper/decorator/decorator_generator.rb
draper-0.7.3 lib/generators/draper/decorator/decorator_generator.rb
draper-0.7.2 lib/generators/draper/decorator/decorator_generator.rb
draper-0.7.1 lib/generators/draper/decorator/decorator_generator.rb
draper-0.7.0 lib/generators/draper/decorator/decorator_generator.rb