Sha256: 38b3b05fad81477ae0e1bb93f3f54bc281c03bddc67ff5b40f6c3b9439327212
Contents?: true
Size: 647 Bytes
Versions: 5
Compression:
Stored size: 647 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 hook_for :test_framework end end
Version data entries
5 entries across 5 versions & 1 rubygems