Parent

Padrino::Generators::Mailer

Responsible for the generating mailers and message definitions.

Public Class Methods

source_root() click to toggle source

Define the source template root

# File lib/padrino-gen/generators/mailer.rb, line 12
def self.source_root; File.expand_path(File.dirname(__FILE__)); end

Public Instance Methods

create_mailer() click to toggle source

Execute mailer generation

@api private

# File lib/padrino-gen/generators/mailer.rb, line 35
def create_mailer
  self.destination_root = options[:root]
  if in_app_root?
    app = options[:app]
    check_app_existence(app)
    self.behavior = :revoke if options[:destroy]
    @app_name = fetch_app_name(app)
    @actions = actions.map{|a| a.to_sym}
    @short_name = name.to_s.gsub(/mailer/, '').underscore.downcase
    @mailer_basename = @short_name.underscore
    template "templates/mailer.rb.tt", destination_root(app, "mailers", "#{@mailer_basename}.rb")
    empty_directory destination_root(app, 'views', 'mailers', @mailer_basename)
  else
    say "You are not at the root of a Padrino application! (config/boot.rb not found)"
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.