From 9a0fa34c0ad453d6118975b9fb0fd77d7bb21d22 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 9 Sep 2018 09:55:43 +1200 Subject: [PATCH 1/5] Style fix up --- spec/factories/member.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/factories/member.rb b/spec/factories/member.rb index 828c2f5aa..70aaaaab8 100644 --- a/spec/factories/member.rb +++ b/spec/factories/member.rb @@ -55,8 +55,8 @@ FactoryBot.define do factory :south_pole_member do sequence(:login_name) { |n| "ScottRF#{n}" } location 'Amundsen-Scott Base, Antarctica' - latitude -90 - longitude 0 + latitude { -90 } + longitude { 0 } end factory :admin_member do From a76f5d3a22d2ee47704ec7f245beb6af38aacf89 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 1 Jan 2019 13:56:08 +1300 Subject: [PATCH 2/5] More locations with production email addresses --- app/mailers/notifier.rb | 2 +- config/application.rb | 2 +- config/initializers/devise.rb | 2 +- spec/mailers/notifier_spec.rb | 20 ++++++++++---------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/mailers/notifier.rb b/app/mailers/notifier.rb index 0d4ea407e..0386450f1 100644 --- a/app/mailers/notifier.rb +++ b/app/mailers/notifier.rb @@ -1,6 +1,6 @@ class Notifier < ApplicationMailer include NotificationsHelper - default from: "Growstuff " + default from: "Growstuff <#{ENV['GROWSTUFF_EMAIL']}>" def verifier unless ENV['RAILS_SECRET_TOKEN'] diff --git a/config/application.rb b/config/application.rb index 0a00a917a..a42ae3bae 100644 --- a/config/application.rb +++ b/config/application.rb @@ -81,7 +81,7 @@ module Growstuff # Growstuff-specific configuration variables config.currency = 'AUD' - config.bot_email = "noreply@growstuff.org" + config.bot_email = ENV['GROWSTUFF_EMAIL'] config.user_agent = 'Growstuff' config.user_agent_email = "info@growstuff.org" diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index fcb4caecc..974551c93 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -5,7 +5,7 @@ Devise.setup do |config| # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class with default "from" parameter. - config.mailer_sender = "Growstuff " + config.mailer_sender = "Growstuff <#{ENV['GROWSTUFF_EMAIL']}>" config.secret_key = ENV['RAILS_SECRET_TOKEN'] diff --git a/spec/mailers/notifier_spec.rb b/spec/mailers/notifier_spec.rb index e50682700..27677eab6 100644 --- a/spec/mailers/notifier_spec.rb +++ b/spec/mailers/notifier_spec.rb @@ -9,8 +9,8 @@ describe Notifier do mail.subject.should == notification.subject end - it 'comes from noreply@growstuff.org' do - mail.from.should == ['noreply@growstuff.org'] + it 'comes from noreply@test.growstuff.org' do + mail.from.should == ['noreply@test.growstuff.org'] end it 'sends the mail to the recipient of the notification' do @@ -26,8 +26,8 @@ describe Notifier do mail.subject.should == "What have you planted lately?" end - it 'comes from noreply@growstuff.org' do - mail.from.should == ['noreply@growstuff.org'] + it 'comes from noreply@test.growstuff.org' do + mail.from.should == ['noreply@test.growstuff.org'] end it 'sends the mail to the recipient of the notification' do @@ -52,8 +52,8 @@ describe Notifier do mail.subject.should == "#{crop.requester.login_name} has requested Ultra berry as a new crop" end - it 'comes from noreply@growstuff.org' do - mail.from.should == ['noreply@growstuff.org'] + it 'comes from noreply@test.growstuff.org' do + mail.from.should == ['noreply@test.growstuff.org'] end it 'sends the mail to the recipient of the notification' do @@ -74,8 +74,8 @@ describe Notifier do expect(mail.subject).to eq "Magic bean has been approved" end - it 'comes from noreply@growstuff.org' do - expect(mail.from).to eq ['noreply@growstuff.org'] + it 'comes from noreply@test.growstuff.org' do + expect(mail.from).to eq ['noreply@test.growstuff.org'] end it 'sends the mail to the recipient of the notification' do @@ -102,8 +102,8 @@ describe Notifier do expect(mail.subject).to eq "Fail bean has been rejected" end - it 'comes from noreply@growstuff.org' do - expect(mail.from).to eq ['noreply@growstuff.org'] + it 'comes from noreply@test.growstuff.org' do + expect(mail.from).to eq ['noreply@test.growstuff.org'] end it 'sends the mail to the recipient of the notification' do From 6df2d9272013c611ef752608da5c3846476bdce0 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 1 Jan 2019 13:59:32 +1300 Subject: [PATCH 3/5] Adding from email to example application.yml --- config/application.yml.example | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/application.yml.example b/config/application.yml.example index ba343b6d0..1ff6b5f99 100644 --- a/config/application.yml.example +++ b/config/application.yml.example @@ -75,9 +75,13 @@ GROWSTUFF_ELASTICSEARCH: "false" # To see current settings on Heroku, use "heroku config --app=whatever". ############################################################################## +### EMAil addres for notifier and mailers to use as from +GROWSTUFF_EMAIL: 'noreply@dev.growstuff.org' + test: GROWSTUFF_SITE_NAME: Growstuff (test) GROWSTUFF_CAPYBARA_DRIVER: poltergeist + GROWSTUFF_EMAIL: 'noreply@test.growstuff.org' # Note: there is no good way to deploy settings from Figaro to # Travis-CI. If you need env vars set there in order for tests to pass, @@ -86,7 +90,9 @@ test: staging: GROWSTUFF_SITE_NAME: Growstuff (staging) GROWSTUFF_ELASTICSEARCH: "true" + GROWSTUFF_EMAIL: 'noreply@staging.growstuff.org' production: GROWSTUFF_SITE_NAME: Growstuff GROWSTUFF_ELASTICSEARCH: "true" + GROWSTUFF_EMAIL: 'noreply@growstuff.org' From 1627c347e4efa5c601c60ef1c971134782647e2f Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 1 Jan 2019 14:07:51 +1300 Subject: [PATCH 4/5] App.json to configure heroku --- app.json | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 app.json diff --git a/app.json b/app.json new file mode 100644 index 000000000..fc266aded --- /dev/null +++ b/app.json @@ -0,0 +1,51 @@ +{ + "name": "growstuff", + "stack": "heroku-18", + "description": "Open data project for small-scale food growers", + "scripts": { + "postdeploy": "bundle exec rails db:migrate db:seed" + }, + "env": { + "GROWSTUFF_ELASTICSEARCH": { + "required": true + }, + "GROWSTUFF_FACEBOOK_KEY": { + "required": true + }, + "GROWSTUFF_FACEBOOK_SECRET": { + "required": true + }, + "GROWSTUFF_FLICKR_KEY": { + "required": true + }, + "GROWSTUFF_FLICKR_SECRET": { + "required": true + }, + "GROWSTUFF_SITE_NAME": { + "required": true + }, + "GROWSTUFF_EMAIL": { + "required": true + }, + "MAIL_SENDER_HOST": { + "required": true + } + }, + "formation": { + "web": { + "quantity": 1 + } + }, + "addons": [ + "heroku-postgresql", + "bonsai-elasticsearch", + "memcachier", + "newrelic", + "sparkhost" + ], + "buildpacks": [ + { + "url": "heroku/ruby" + } + ] +} From 28dcc573076b767669620a3bb8cf10caa824b137 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 1 Jan 2019 14:10:04 +1300 Subject: [PATCH 5/5] Set email env on travis runs --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index cf2a27a7f..d8959f060 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ env: - STATIC_CHECKS=true global: - secure: "Z5TpM2jEX4UCvNePnk/LwltQX48U2u9BRc+Iypr1x9QW2o228QJhPIOH39a8RMUrepGnkQIq9q3ZRUn98RfrJz1yThtlNFL3NmzdQ57gKgjGwfpa0e4Dwj/ZJqV2D84tDGjvdVYLP7zzaYZxQcwk/cgNpzKf/jq97HLNP7CYuf4=" + - GROWSTUFF_EMAIL="noreply@test.growstuff.org" - GROWSTUFF_SITE_NAME="Growstuff (travis)" - RAILS_SECRET_TOKEN='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' before_install: