Sha256: f8a811f5a0c33dc0eebef4e9f958d9a523646a3255ae26af247b779181966a0b

Contents?: true

Size: 989 Bytes

Versions: 7

Compression:

Stored size: 989 Bytes

Contents

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

    # overrides the default
    argument :name, :type => :string, :default => 'user', :optional => true

    include Generators::Hobo::InviteOnly
    include Generators::Hobo::ActivationEmail

    def self.banner
      "rails generate hobo:user_mailer [NAME=user] [options]"
    end

    # check_class_collision :suffix => 'Mailer'

    def generate_mailer
      template 'mailer.rb.erb', File.join('app/mailers', "#{file_path}_mailer.rb")
    end

    def generate_mails
      mailer_dir = File.join("app/views", class_path[0..-2], "#{file_name.singularize}_mailer")
      template 'forgot_password.erb', File.join(mailer_dir, "forgot_password.erb")
      template( 'invite.erb', File.join(mailer_dir, "invite.erb")) if invite_only?
      template( 'activation.erb', File.join(mailer_dir, "activation.erb")) if options[:activation_email]
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hobo-2.2.6 lib/generators/hobo/user_mailer/user_mailer_generator.rb
hobo-2.2.5 lib/generators/hobo/user_mailer/user_mailer_generator.rb
hobo-2.2.4 lib/generators/hobo/user_mailer/user_mailer_generator.rb
hobo-2.2.3 lib/generators/hobo/user_mailer/user_mailer_generator.rb
hobo-2.2.2 lib/generators/hobo/user_mailer/user_mailer_generator.rb
hobo-2.2.1 lib/generators/hobo/user_mailer/user_mailer_generator.rb
hobo-2.2.0 lib/generators/hobo/user_mailer/user_mailer_generator.rb