Class: WelcomeCycle::Generators::EmailGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- WelcomeCycle::Generators::EmailGenerator
- Defined in:
- lib/generators/welcome_cycle/email/email_generator.rb
Instance Method Summary collapse
Instance Method Details
#add_new_mailer_action ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/generators/welcome_cycle/email/email_generator.rb', line 23 def add_new_mailer_action gsub_file 'app/mailers/welcome_cycle_mailer.rb', '# your actions here', '' inject_into_class 'app/mailers/welcome_cycle_mailer.rb', WelcomeCycleMailer do "\n def \#{file_name}(recipient)\n mail(:to => recipient.email, :subject => 'Your subject here')\n end\n" end end |
#add_new_mailer_templates ⇒ Object
35 36 37 38 |
# File 'lib/generators/welcome_cycle/email/email_generator.rb', line 35 def add_new_mailer_templates create_file "app/views/welcome_cycle_mailer/#{file_name}.text.erb" create_file "app/views/welcome_cycle_mailer/#{file_name}.html.erb" end |
#register_new_mail ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/generators/welcome_cycle/email/email_generator.rb', line 7 def register_new_mail append_to_file 'config/initializers/welcome_cycle.rb' do "\n\nWelcomeCycle::Email.new(\"\#{file_name.gsub(/_/, ' ').capitalize}\") do\n days_into_cycle 5, 10 # Send on 5 and 10 days into trial\n days_offset_from_cycle_end -5, 5 # Send 5 days before and 5 days after the cycle ends\n scope do\n # send if these Arel conditions are met\n end\nend\n EOS\n end\nend\n" |