Sha256: c44393412291687eb496914bb612235593856a474ace0add1423e5bc8c469bfc

Contents?: true

Size: 1.06 KB

Versions: 33

Compression:

Stored size: 1.06 KB

Contents

module Merb::Generators
  class MailerGenerator < NamespacedGenerator
 
    def self.source_root
      File.dirname(__FILE__) / 'templates' / 'mailer'
    end
    
    desc <<-DESC
      Generates a mailer
    DESC
    
    option :testing_framework, :desc => 'Testing framework to use (one of: rspec, test_unit)'
    
    first_argument :name, :required => true, :desc => "mailer name"
    
    template :mailer do |t|
      t.source = 'app/mailers/%file_name%_mailer.rb'
      t.destination = File.join("app/mailers", base_path, "#{file_name}_mailer.rb")
    end
    
    template :notify_on_event do |t|
      t.source = 'app/mailers/views/%file_name%_mailer/notify_on_event.text.erb'
      t.destination = File.join("app/mailers/views", base_path, "#{file_name}_mailer/notify_on_event.text.erb")
    end
    
    template :controller_spec, :testing_framework => :rspec do |t|
      t.source = 'spec/mailers/%file_name%_mailer_spec.rb'
      t.destination = File.join("spec/mailers", base_path, "#{file_name}_mailer_spec.rb")
    end
 
  end
 
  add :mailer, MailerGenerator
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
merb-mailer-1.1.3 lib/generators/mailer_generator.rb
merb-mailer-1.1.2 lib/generators/mailer_generator.rb
merb-mailer-1.1.1 lib/generators/mailer_generator.rb
merb-mailer-1.1.0 lib/generators/mailer_generator.rb
merb-mailer-1.1.0.rc1 lib/generators/mailer_generator.rb
merb-mailer-1.1.0.pre lib/generators/mailer_generator.rb
merb-mailer-1.0.15 lib/generators/mailer_generator.rb
merb-mailer-1.0.14 lib/generators/mailer_generator.rb
merb-mailer-1.0.13 lib/generators/mailer_generator.rb
merb-mailer-1.0.12 lib/generators/mailer_generator.rb
merb-mailer-0.9.10 lib/generators/mailer_generator.rb
merb-mailer-0.9.11 lib/generators/mailer_generator.rb
merb-mailer-0.9.12 lib/generators/mailer_generator.rb
merb-mailer-0.9.13 lib/generators/mailer_generator.rb
merb-mailer-0.9.6 lib/generators/mailer_generator.rb
merb-mailer-0.9.8 lib/generators/mailer_generator.rb
merb-mailer-0.9.9 lib/generators/mailer_generator.rb
merb-mailer-1.0.1 lib/generators/mailer_generator.rb
merb-mailer-0.9.7 lib/generators/mailer_generator.rb
merb-mailer-1.0.6.1 lib/generators/mailer_generator.rb