Class: Pah::Templates::Sendgrid

Inherits:
Pah::Template
  • Object
show all
Defined in:
lib/pah/templates/sendgrid.rb

Instance Method Summary collapse

Methods inherited from Pah::Template

#ask_unless_test, #copy_static_file, #git_commit, #static_files, #will_you_like_to?

Instance Method Details

#callObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/pah/templates/sendgrid.rb', line 4

def call
  sendgrid_config = "\n  # SendGrid config\n  config.action_mailer.default_url_options = { host: ENV['CANONICAL_HOST'] }\n  config.action_mailer.smtp_settings = {\n    address:              'smtp.sendgrid.net',\n    port:                 '587',\n    authentication:       :plain,\n    user_name:            ENV['SENDGRID_USERNAME'],\n    password:             ENV['SENDGRID_PASSWORD'],\n    domain:               'heroku.com',\n    enable_starttls_auto: true\n  }\n"

  inject_into_file 'config/environments/production.rb', sendgrid_config,  before: /^end/, verbose: false

  git add: 'config/environments/production.rb'
  git_commit 'Add Sendgrid config.'
end