Skip to content

Commit

Permalink
fix for rails-omniauth secrets.yml file
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielKehoe committed Apr 12, 2014
1 parent ac1aefc commit 49f4521
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.textile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ h1. CHANGELOG

h2. 2.4.44 unreleased

* use 'example.com' for domain_name in secrets.yml file
* fix for rails-omniauth secrets.yml file
* fix email recipe to restore correct behavior for 'none' option

h2. 2.4.43 April 12, 2014
Expand Down
20 changes: 11 additions & 9 deletions recipes/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
when 'smtp'
secrets_email = foreman_email = ''
when 'gmail'
secrets_email = " email_provider_username: <%= ENV[\"GMAIL_USERNAME\"] %>\n email_provider_password: <%= ENV[\"GMAIL_PASSWORD\"] %>\n domain_name: <%= ENV[\"DOMAIN_NAME\"] %>"
foreman_email = "GMAIL_USERNAME=Your_Username\nGMAIL_PASSWORD=Your_Password\nDOMAIN_NAME=Your_Domain\n"
secrets_email = " email_provider_username: <%= ENV[\"GMAIL_USERNAME\"] %>\n email_provider_password: <%= ENV[\"GMAIL_PASSWORD\"] %>\n domain_name: example.com %>"
foreman_email = "GMAIL_USERNAME=Your_Username\nGMAIL_PASSWORD=Your_Password\nDOMAIN_NAME=example.com\n"
when 'sendgrid'
secrets_email = " email_provider_username: <%= ENV[\"SENDGRID_USERNAME\"] %>\n email_provider_password: <%= ENV[\"SENDGRID_PASSWORD\"] %>\n domain_name: <%= ENV[\"DOMAIN_NAME\"] %>"
foreman_email = "SENDGRID_USERNAME=Your_Username\nSENDGRID_PASSWORD=Your_Password\nDOMAIN_NAME=Your_Domain\n"
secrets_email = " email_provider_username: <%= ENV[\"SENDGRID_USERNAME\"] %>\n email_provider_password: <%= ENV[\"SENDGRID_PASSWORD\"] %>\n domain_name: example.com %>"
foreman_email = "SENDGRID_USERNAME=Your_Username\nSENDGRID_PASSWORD=Your_Password\nDOMAIN_NAME=example.com\n"
when 'mandrill'
secrets_email = " email_provider_username: <%= ENV[\"MANDRILL_USERNAME\"] %>\n email_provider_apikey: <%= ENV[\"MANDRILL_APIKEY\"] %>\n domain_name: <%= ENV[\"DOMAIN_NAME\"] %>"
foreman_email = "MANDRILL_USERNAME=Your_Username\nMANDRILL_APIKEY=Your_API_Key\nDOMAIN_NAME=Your_Domain\n"
secrets_email = " email_provider_username: <%= ENV[\"MANDRILL_USERNAME\"] %>\n email_provider_apikey: <%= ENV[\"MANDRILL_APIKEY\"] %>\n domain_name: example.com %>"
foreman_email = "MANDRILL_USERNAME=Your_Username\nMANDRILL_APIKEY=Your_API_Key\nDOMAIN_NAME=example.com\n"
end
figaro_email = foreman_email.gsub('=', ': ')
secrets_d_devise = " admin_name: First User\n admin_email: user@example.com\n admin_password: changeme"
Expand All @@ -32,7 +32,7 @@
## EMAIL
inject_into_file 'config/secrets.yml', "\n" + secrets_email, :after => "development:" if rails_4_1?
### 'inject_into_file' doesn't let us inject the same text twice unless we append the extra space, why?
inject_into_file 'config/secrets.yml', "\n" + secrets_email + " " , :after => "production:" if rails_4_1?
inject_into_file 'config/secrets.yml', "\n" + secrets_email + " ", :after => "production:" if rails_4_1?
append_file '.env', foreman_email if prefer :local_env_file, 'foreman'
append_file 'config/application.yml', figaro_email if prefer :local_env_file, 'figaro'
## DEVISE
Expand All @@ -45,14 +45,16 @@
## OMNIAUTH
if prefer :authentication, 'omniauth'
inject_into_file 'config/secrets.yml', "\n" + secrets_omniauth, :after => "development:" if rails_4_1?
inject_into_file 'config/secrets.yml', "\n" + secrets_omniauth, :after => "production:" if rails_4_1?
### 'inject_into_file' doesn't let us inject the same text twice unless we append the extra space, why?
inject_into_file 'config/secrets.yml', "\n" + secrets_omniauth + " ", :after => "production:" if rails_4_1?
append_file '.env', foreman_omniauth if prefer :local_env_file, 'foreman'
append_file 'config/application.yml', figaro_omniauth if prefer :local_env_file, 'figaro'
end
## CANCAN
if (prefer :authorization, 'cancan')
inject_into_file 'config/secrets.yml', "\n" + secrets_cancan, :after => "development:" if rails_4_1?
inject_into_file 'config/secrets.yml', "\n" + secrets_cancan, :after => "production:" if rails_4_1?
### 'inject_into_file' doesn't let us inject the same text twice unless we append the extra space, why?
inject_into_file 'config/secrets.yml', "\n" + secrets_cancan + " ", :after => "production:" if rails_4_1?
append_file '.env', foreman_cancan if prefer :local_env_file, 'foreman'
append_file 'config/application.yml', figaro_cancan if prefer :local_env_file, 'figaro'
end
Expand Down

0 comments on commit 49f4521

Please sign in to comment.