Skip to content

Commit

Permalink
A minor change to Roadie config
Browse files Browse the repository at this point in the history
  • Loading branch information
glebm committed Mar 26, 2017
1 parent 0e580bc commit 8276be3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/thredded_create_app/tasks/add_roadie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,21 @@ def after_bundle
before: /\nend\n\z$/,
content: indent(2, "\n" + roadie_production_config)
replace 'app/views/layouts/mailer.html.erb',
%r{<style>.*?</style>}m,
"<%= stylesheet_link_tag 'email' %>"
%r{ *<style>.*?</style>\n}m,
indent(4, mailer_template_head)
git_commit 'Add Roadie configuration'
end

private

def mailer_template_head
<<~'ERB'
<%# Ensure the stylesheet is referenced without a host so that the local
version is read by Roadie even if asset_host is set. %>
<link rel="stylesheet" href="<%= stylesheet_path('email', host: '') %>" />
ERB
end

def roadie_development_config
<<~'RUBY'
# Set the default URL options for both Roadie and ActionMailer:
Expand All @@ -46,9 +54,6 @@ def roadie_development_config

def roadie_production_config
<<~'RUBY'
# Roadie requires that action_mailer.asset_host is nil, see:
# https://github.com/Mange/roadie-rails/blob/9e3cb2ed59f4ec9fda252ad016b23e106983a440/README.md#known-issues
config.action_mailer.asset_host = nil
# Set the default URL options for both Roadie and ActionMailer:
config.roadie.url_options = config.action_mailer.default_url_options = {
host: ENV['APP_HOST'] || '[SET ME] myapp.herokuapp.com',
Expand Down

0 comments on commit 8276be3

Please sign in to comment.