Upgrade to Rails 6.0.3

This commit is contained in:
Eric 2020-05-20 15:36:31 -05:00
parent 54c4b76693
commit d0393fa2d7
12 changed files with 319 additions and 219 deletions

View file

@ -3,7 +3,7 @@
source 'https://rubygems.org' source 'https://rubygems.org'
ruby '2.6.6' ruby '2.6.6'
gem 'rails', '~> 5.2.3' gem 'rails', '~> 6.0.3'
gem 'jbuilder', '~> 2.10' gem 'jbuilder', '~> 2.10'
gem 'bootsnap', '~> 1.4', require: false # Large rails application booting enhancer gem 'bootsnap', '~> 1.4', require: false # Large rails application booting enhancer
gem 'font_assets', '~> 0.1.14' # for serving fonts on cdn https://github.com/ericallam/font_assets gem 'font_assets', '~> 0.1.14' # for serving fonts on cdn https://github.com/ericallam/font_assets
@ -40,7 +40,7 @@ gem 'geocoder', '~> 1.5' # for adding latitude and longitude to location-based t
gem 'i18n-js', '~> 3.3' gem 'i18n-js', '~> 3.3'
gem 'lograge', '~> 0.11.2' # make logging less terrible in rails gem 'lograge', '~> 0.11.2' # make logging less terrible in rails
gem 'nearest_time_zone', '~> 0.0.4' # for detecting timezone from lat/lng https://github.com/buytruckload/nearest_time_zone gem 'nearest_time_zone', '~> 0.0.4' # for detecting timezone from lat/lng https://github.com/buytruckload/nearest_time_zone
gem 'rails-i18n', '~> 5.1', '>= 5.1.3' gem 'rails-i18n', '~> 6', '~> 6.0.0'
gem 'roadie-rails', '~> 2.1' # email generation helpers gem 'roadie-rails', '~> 2.1' # email generation helpers
gem 'table_print', '~> 1.5', '>= 1.5.6' # Nice table printing of data for the console gem 'table_print', '~> 1.5', '>= 1.5.6' # Nice table printing of data for the console
@ -58,12 +58,12 @@ gem 'image_processing', '~> 1.10.3'
# User authentication # User authentication
# https://github.com/plataformatec/devise # https://github.com/plataformatec/devise
gem 'devise-async', '~> 1.0' gem 'devise-async', '~> 1.0'
gem 'devise', '~> 4.4' gem 'devise', '~> 4.7'
# API Tools # API Tools
gem 'config', '> 1.5' gem 'config', '> 1.5'
gem 'dry-validation', '~> 0.13.3' # used only for config validation gem 'dry-validation', '~> 0.13.3' # used only for config validation
gem 'foreman', '~> 0.85.0' gem 'foreman', '~> 0.87.1'
gem 'wisper', '~> 2.0' gem 'wisper', '~> 2.0'
gem 'wisper-activejob', '~> 1.0.0' gem 'wisper-activejob', '~> 1.0.0'
@ -87,6 +87,7 @@ group :development, :ci, :test do
gem 'parallel_tests', '~> 2.32' gem 'parallel_tests', '~> 2.32'
gem 'factory_bot_rails', '~> 5.0', '>= 5.0.2' gem 'factory_bot_rails', '~> 5.0', '>= 5.0.2'
gem 'factory_bot', '~> 5.0', '>= 5.0.2' gem 'factory_bot', '~> 5.0', '>= 5.0.2'
gem 'listen'
end end
group :ci, :test do group :ci, :test do

View file

@ -25,52 +25,65 @@ GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
action_mailer_matchers (1.2.0) action_mailer_matchers (1.2.0)
actioncable (5.2.3) actioncable (6.0.3.1)
actionpack (= 5.2.3) actionpack (= 6.0.3.1)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailer (5.2.3) actionmailbox (6.0.3.1)
actionpack (= 5.2.3) actionpack (= 6.0.3.1)
actionview (= 5.2.3) activejob (= 6.0.3.1)
activejob (= 5.2.3) activerecord (= 6.0.3.1)
activestorage (= 6.0.3.1)
activesupport (= 6.0.3.1)
mail (>= 2.7.1)
actionmailer (6.0.3.1)
actionpack (= 6.0.3.1)
actionview (= 6.0.3.1)
activejob (= 6.0.3.1)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (5.2.3) actionpack (6.0.3.1)
actionview (= 5.2.3) actionview (= 6.0.3.1)
activesupport (= 5.2.3) activesupport (= 6.0.3.1)
rack (~> 2.0) rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionview (5.2.3) actiontext (6.0.3.1)
activesupport (= 5.2.3) actionpack (= 6.0.3.1)
activerecord (= 6.0.3.1)
activestorage (= 6.0.3.1)
activesupport (= 6.0.3.1)
nokogiri (>= 1.8.5)
actionview (6.0.3.1)
activesupport (= 6.0.3.1)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3) rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (5.2.3) activejob (6.0.3.1)
activesupport (= 5.2.3) activesupport (= 6.0.3.1)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (5.2.3) activemodel (6.0.3.1)
activesupport (= 5.2.3) activesupport (= 6.0.3.1)
activerecord (5.2.3) activerecord (6.0.3.1)
activemodel (= 5.2.3) activemodel (= 6.0.3.1)
activesupport (= 5.2.3) activesupport (= 6.0.3.1)
arel (>= 9.0) activestorage (6.0.3.1)
activestorage (5.2.3) actionpack (= 6.0.3.1)
actionpack (= 5.2.3) activejob (= 6.0.3.1)
activerecord (= 5.2.3) activerecord (= 6.0.3.1)
marcel (~> 0.3.1) marcel (~> 0.3.1)
activesupport (5.2.3) activesupport (6.0.3.1)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
minitest (~> 5.1) minitest (~> 5.1)
tzinfo (~> 1.1) tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.6.0) addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0) public_suffix (>= 2.0.2, < 4.0)
amq-protocol (2.3.0) amq-protocol (2.3.0)
andand (1.3.3) andand (1.3.3)
arel (9.0.0)
ast (2.4.0) ast (2.4.0)
aws-sdk (1.67.0) aws-sdk (1.67.0)
aws-sdk-v1 (= 1.67.0) aws-sdk-v1 (= 1.67.0)
@ -115,10 +128,10 @@ GEM
debase-ruby_core_source (0.10.5) debase-ruby_core_source (0.10.5)
debug_inspector (0.0.3) debug_inspector (0.0.3)
deep_merge (1.2.1) deep_merge (1.2.1)
devise (4.6.2) devise (4.7.1)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 4.1.0, < 6.0) railties (>= 4.1.0)
responders responders
warden (~> 1.2.3) warden (~> 1.2.3)
devise-async (1.0.0) devise-async (1.0.0)
@ -174,8 +187,7 @@ GEM
ffi (1.11.1) ffi (1.11.1)
font_assets (0.1.14) font_assets (0.1.14)
rack rack
foreman (0.85.0) foreman (0.87.1)
thor (~> 0.19.1)
fullcontact (0.18.0) fullcontact (0.18.0)
faraday (~> 0.11.0) faraday (~> 0.11.0)
faraday_middleware (>= 0.10) faraday_middleware (>= 0.10)
@ -209,6 +221,9 @@ GEM
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
json (1.8.6) json (1.8.6)
kdtree (0.4) kdtree (0.4)
listen (3.2.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
lograge (0.11.2) lograge (0.11.2)
actionpack (>= 4) actionpack (>= 4)
activesupport (>= 4) activesupport (>= 4)
@ -227,11 +242,11 @@ GEM
mime-types (3.2.2) mime-types (3.2.2)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2019.0331) mime-types-data (3.2019.0331)
mimemagic (0.3.3) mimemagic (0.3.5)
mini_magick (4.10.1) mini_magick (4.10.1)
mini_mime (1.0.2) mini_mime (1.0.2)
mini_portile2 (2.4.0) mini_portile2 (2.4.0)
minitest (5.14.0) minitest (5.14.1)
msgpack (1.3.1) msgpack (1.3.1)
multi_json (1.13.1) multi_json (1.13.1)
multi_xml (0.6.0) multi_xml (0.6.0)
@ -241,7 +256,7 @@ GEM
kdtree kdtree
require_all require_all
netrc (0.11.0) netrc (0.11.0)
nio4r (2.4.0) nio4r (2.5.2)
nokogiri (1.10.9) nokogiri (1.10.9)
mini_portile2 (~> 2.4.0) mini_portile2 (~> 2.4.0)
orm_adapter (0.5.0) orm_adapter (0.5.0)
@ -276,35 +291,40 @@ GEM
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rack-timeout (0.5.1) rack-timeout (0.5.1)
rails (5.2.3) rails (6.0.3.1)
actioncable (= 5.2.3) actioncable (= 6.0.3.1)
actionmailer (= 5.2.3) actionmailbox (= 6.0.3.1)
actionpack (= 5.2.3) actionmailer (= 6.0.3.1)
actionview (= 5.2.3) actionpack (= 6.0.3.1)
activejob (= 5.2.3) actiontext (= 6.0.3.1)
activemodel (= 5.2.3) actionview (= 6.0.3.1)
activerecord (= 5.2.3) activejob (= 6.0.3.1)
activestorage (= 5.2.3) activemodel (= 6.0.3.1)
activesupport (= 5.2.3) activerecord (= 6.0.3.1)
activestorage (= 6.0.3.1)
activesupport (= 6.0.3.1)
bundler (>= 1.3.0) bundler (>= 1.3.0)
railties (= 5.2.3) railties (= 6.0.3.1)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0) rails-html-sanitizer (1.3.0)
loofah (~> 2.3) loofah (~> 2.3)
rails-i18n (5.1.3) rails-i18n (6.0.0)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
railties (>= 5.0, < 6) railties (>= 6.0.0, < 7)
railties (5.2.3) railties (6.0.3.1)
actionpack (= 5.2.3) actionpack (= 6.0.3.1)
activesupport (= 5.2.3) activesupport (= 6.0.3.1)
method_source method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0) thor (>= 0.20.3, < 2.0)
rainbow (3.0.0) rainbow (3.0.0)
rake (12.3.3) rake (12.3.3)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
request_store (1.4.1) request_store (1.4.1)
rack (>= 1.4) rack (>= 1.4)
require_all (2.0.0) require_all (2.0.0)
@ -389,7 +409,7 @@ GEM
table_print (1.5.6) table_print (1.5.6)
test-unit (3.3.3) test-unit (3.3.3)
power_assert power_assert
thor (0.19.4) thor (1.0.1)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.9) tilt (2.0.9)
timecop (0.9.1) timecop (0.9.1)
@ -424,6 +444,7 @@ GEM
wisper wisper
wisper-rspec (1.1.0) wisper-rspec (1.1.0)
xml-simple (1.1.5) xml-simple (1.1.5)
zeitwerk (2.3.0)
PLATFORMS PLATFORMS
ruby ruby
@ -442,7 +463,7 @@ DEPENDENCIES
countries (~> 3.0) countries (~> 3.0)
database_cleaner (~> 1.7) database_cleaner (~> 1.7)
debase (~> 0.2.3) debase (~> 0.2.3)
devise (~> 4.4) devise (~> 4.7)
devise-async (~> 1.0) devise-async (~> 1.0)
dotenv-rails (~> 2.7, >= 2.7.5) dotenv-rails (~> 2.7, >= 2.7.5)
dry-validation (~> 0.13.3) dry-validation (~> 0.13.3)
@ -450,7 +471,7 @@ DEPENDENCIES
factory_bot_rails (~> 5.0, >= 5.0.2) factory_bot_rails (~> 5.0, >= 5.0.2)
ffi (~> 1.11, >= 1.11.1) ffi (~> 1.11, >= 1.11.1)
font_assets (~> 0.1.14) font_assets (~> 0.1.14)
foreman (~> 0.85.0) foreman (~> 0.87.1)
fullcontact (~> 0.18.0) fullcontact (~> 0.18.0)
geocoder (~> 1.5) geocoder (~> 1.5)
hamster (~> 3.0) hamster (~> 3.0)
@ -459,6 +480,7 @@ DEPENDENCIES
i18n-js (~> 3.3) i18n-js (~> 3.3)
image_processing (~> 1.10.3) image_processing (~> 1.10.3)
jbuilder (~> 2.10) jbuilder (~> 2.10)
listen
lograge (~> 0.11.2) lograge (~> 0.11.2)
mail_view (~> 2.0) mail_view (~> 2.0)
mini_magick (~> 4.10.1) mini_magick (~> 4.10.1)
@ -476,8 +498,8 @@ DEPENDENCIES
rack-attack (~> 5.2) rack-attack (~> 5.2)
rack-ssl (~> 1.4) rack-ssl (~> 1.4)
rack-timeout (~> 0.5.1) rack-timeout (~> 0.5.1)
rails (~> 5.2.3) rails (~> 6.0.3)
rails-i18n (~> 5.1, >= 5.1.3) rails-i18n (~> 6.0.0, ~> 6)
rake (~> 12.3.2) rake (~> 12.3.2)
roadie-rails (~> 2.1) roadie-rails (~> 2.1)
rspec (~> 3.8) rspec (~> 3.8)

View file

@ -1,19 +1,16 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# frozen_string_literal: true
require 'pathname'
require 'fileutils' require 'fileutils'
include FileUtils
# path to your application root. # path to your application root.
APP_ROOT = Pathname.new File.expand_path('..', __dir__) APP_ROOT = File.expand_path('..', __dir__)
def system!(*args) def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==") system(*args) || abort("\n== Command #{args} failed ==")
end end
chdir APP_ROOT do FileUtils.chdir APP_ROOT do
# This script is a starting point to setup your application. # This script is a way to setup or update your development environment automatically.
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
# Add necessary setup steps to this file. # Add necessary setup steps to this file.
puts '== Installing dependencies ==' puts '== Installing dependencies =='
@ -22,11 +19,11 @@ chdir APP_ROOT do
# puts "\n== Copying sample files ==" # puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml') # unless File.exist?('config/database.yml')
# cp 'config/database.yml.sample', 'config/database.yml' # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
# end # end
puts "\n== Preparing database ==" puts "\n== Preparing database =="
system! 'bin/rails db:setup' system! 'bin/rails db:prepare'
puts "\n== Removing old logs and tempfiles ==" puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear' system! 'bin/rails log:clear tmp:clear'

View file

@ -11,6 +11,8 @@ require "active_record/railtie"
require "active_storage/engine" require "active_storage/engine"
require "action_controller/railtie" require "action_controller/railtie"
require "action_mailer/railtie" require "action_mailer/railtie"
# require "action_mailbox/engine"
# require "action_text/engine"
require "action_view/railtie" require "action_view/railtie"
# require "action_cable/engine" # require "action_cable/engine"
# require "sprockets/railtie" # require "sprockets/railtie"

View file

@ -17,12 +17,14 @@ Rails.application.configure do
config.consider_all_requests_local = true config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled. # Enable/disable caching. By default caching is disabled.
if Rails.root.join('tmp/caching-dev.txt').exist? # Run rails dev:cache to toggle caching.
if Rails.root.join('tmp', 'caching-dev.txt').exist?
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true
config.cache_store = :memory_store config.cache_store = :memory_store
config.public_file_server.headers = { config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=172800' 'Cache-Control' => "public, max-age=#{2.days.to_i}"
} }
else else
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
@ -30,15 +32,8 @@ Rails.application.configure do
config.cache_store = :null_store config.cache_store = :null_store
end end
# You can uncomment the following to test our real AWS email server on localhost: # Store uploaded files on the local file system (see config/storage.yml for options).
# config.action_mailer.delivery_method = :aws_ses config.active_storage.service = :local
# config.action_mailer.default_url_options = { host: 'commitchange.com' }
config.action_mailer.delivery_method = Settings.mailer.delivery_method.to_sym
config.action_mailer.smtp_settings = { address: Settings.mailer.address, port: Settings.mailer.port }
config.action_mailer.smtp_settings['user_name'] = Settings.mailer.username if Settings.mailer.username
config.action_mailer.smtp_settings['password'] = Settings.mailer.password if Settings.mailer.password
config.action_mailer.default_url_options = { host: Settings.mailer.host }
# Don't care if the mailer can't send. # Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false config.action_mailer.raise_delivery_errors = false
@ -48,12 +43,12 @@ Rails.application.configure do
# Print deprecation notices to the Rails logger. # Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log config.active_support.deprecation = :log
# Raise exception on mass assignment protection for Active Record models
# config.active_record.mass_assignment_sanitizer = :strict
# Raise an error on page load if there are pending migrations. # Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load config.active_record.migration_error = :page_load
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
# Debug mode disables concatenation and preprocessing of assets. # Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large # This option may cause significant delays in view rendering with a large
# number of complex assets. # number of complex assets.
@ -62,27 +57,16 @@ Rails.application.configure do
# Suppress logger output for asset requests. # Suppress logger output for asset requests.
config.assets.quiet = true config.assets.quiet = true
# Adds additional error checking when serving assets at runtime. # Raises error for missing translations.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true # config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code, # Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem. # routes, locales, etc. This feature depends on the listen gem.
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.log_level = :debug config.log_level = :debug
config.dependency_loading = true if $rails_rake_task config.dependency_loading = true if $rails_rake_task
config.middleware.use I18n::JS::Middleware config.middleware.use I18n::JS::Middleware
# SASS Helpers
config.sass.inline_source_maps = true
config.sass.line_comments = false
config.active_storage.service = :local
end end

View file

@ -1,5 +1,3 @@
# frozen_string_literal: true
Rails.application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
@ -21,12 +19,15 @@ Rails.application.configure do
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
# config.action_dispatch.rack_cache = true # config.action_dispatch.rack_cache = true
# Disable serving static files from thne `/public` folder by default since # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this. # Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS. # Compress CSS using a preprocessor.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass # config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed. # Do not fallback to assets pipeline if a precompiled asset is missed.
@ -34,31 +35,32 @@ Rails.application.configure do
# Generate digests for assets URLs. # Generate digests for assets URLs.
config.assets.digest = true config.assets.digest = true
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Enable serving of images, stylesheets, and JavaScripts from an asset server. # Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com' # config.action_controller.asset_host = 'http://assets.example.com'
# Specifies the header that your server uses for sending files. # Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for Nginx # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = true config.force_ssl = true
# Set to :debug to see everything in the log. # Use the lowest log level to ensure availability of diagnostic information
config.log_level = :info # when problems arise.
config.log_level = :debug
# Prepend all log lines with the following tags. # Prepend all log lines with the following tags.
config.log_tags = [:request_id] config.log_tags = [ :request_id ]
# Use a different cache store in production. # Use a different cache store in production.
# config.cache_store = :mem_cache_store # config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment) # Use a real queuing backend for Active Job (and separate queues per environment).
# config.active_job.queue_adapter = :resque # config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "commitchange_#{Rails.env}" # config.active_job.queue_name_prefix = "commitchange_production"
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
@ -80,12 +82,33 @@ Rails.application.configure do
# require 'syslog/logger' # require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV['RAILS_LOG_TO_STDOUT'].present? if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT) logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger) config.logger = ActiveSupport::TaggedLogging.new(logger)
end end
# Do not dump schema after migrations. # Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false config.active_record.dump_schema_after_migration = false
# Inserts middleware to perform automatic connection switching.
# The `database_selector` hash is used to pass options to the DatabaseSelector
# middleware. The `delay` is used to determine how long to wait after a write
# to send a subsequent read to the primary.
#
# The `database_resolver` class is used by the middleware to determine which
# database is appropriate to use based on the time delay.
#
# The `database_resolver_context` class is used by the middleware to set
# timestamps for the last write to the primary. The resolver uses the context
# class timestamps to determine how long to wait before reading from the
# replica.
#
# By default Rails will store a last write timestamp in the session. The
# DatabaseSelector middleware is designed as such you can define your own
# strategy for connection switching and pass that into the middleware through
# these configuration options.
# config.active_record.database_selector = { delay: 2.seconds }
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
end end

View file

@ -1,12 +1,11 @@
# frozen_string_literal: true # The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Commitchange::Application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application # Do not eager load code on boot. This avoids loading your whole application
@ -17,12 +16,13 @@ Commitchange::Application.configure do
# Configure public file server for tests with Cache-Control for performance. # Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true config.public_file_server.enabled = true
config.public_file_server.headers = { config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=3600' 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
} }
# Show full error reports and disable caching. # Show full error reports and disable caching.
config.consider_all_requests_local = true config.consider_all_requests_local = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
config.cache_store = :null_store
# Raise exceptions instead of rendering exception templates. # Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false config.action_dispatch.show_exceptions = false
@ -30,6 +30,9 @@ Commitchange::Application.configure do
# Disable request forgery protection in test environment. # Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false config.action_controller.allow_forgery_protection = false
# Store uploaded files on the local file system in a temporary directory.
config.active_storage.service = :test
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world. # Tell Action Mailer not to deliver emails to the real world.
@ -43,11 +46,10 @@ Commitchange::Application.configure do
config.action_mailer.default_url_options = { host: 'houdiniproject.test' } config.action_mailer.default_url_options = { host: 'houdiniproject.test' }
# Raises error for missing translations # Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true # config.action_view.raise_on_missing_translations = true
#recommended by https://github.com/grosser/parallel_tests/wiki #recommended by https://github.com/grosser/parallel_tests/wiki
config.cache_store = :file_store, Rails.root.join("tmp", "cache", "paralleltests#{ENV['TEST_ENV_NUMBER']}") config.cache_store = :file_store, Rails.root.join("tmp", "cache", "paralleltests#{ENV['TEST_ENV_NUMBER']}")
config.active_storage.service = :test
end end

View file

@ -1,6 +1,28 @@
# frozen_string_literal: true # Be sure to restart your server when you modify this file.
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later # Define an application-wide content security policy
Rails.application.config.content_security_policy do |policy| # For further information see the following documentation
policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
end
# Rails.application.config.content_security_policy do |policy|
# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https
# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# end
# If you are using UJS then enable automatic nonce generation
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
# Set the nonce only to specific directives
# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
# Report CSP violations to a specified URI
# For further information see the following documentation:
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
# Rails.application.config.content_security_policy_report_only = true

View file

@ -0,0 +1,45 @@
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 6.0 upgrade.
#
# Once upgraded flip defaults one by one to migrate to the new default.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# Don't force requests from old versions of IE to be UTF-8 encoded.
# Rails.application.config.action_view.default_enforce_utf8 = false
# Embed purpose and expiry metadata inside signed and encrypted
# cookies for increased security.
#
# This option is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.0.
# Rails.application.config.action_dispatch.use_cookies_with_metadata = true
# Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification.
# Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false
# Return false instead of self when enqueuing is aborted from a callback.
# Rails.application.config.active_job.return_false_on_aborted_enqueue = true
# Send Active Storage analysis and purge jobs to dedicated queues.
# Rails.application.config.active_storage.queues.analysis = :active_storage_analysis
# Rails.application.config.active_storage.queues.purge = :active_storage_purge
# When assigning to a collection of attachments declared via `has_many_attached`, replace existing
# attachments instead of appending. Use #attach to add new attachments without replacing existing ones.
# Rails.application.config.active_storage.replace_on_assign_to_many = true
# Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail.
#
# The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob),
# will be removed in Rails 6.1. This setting is not backwards compatible with earlier Rails versions.
# If you send mail in the background, job workers need to have a copy of
# MailDeliveryJob to ensure all delivery jobs are processed properly.
# Make sure your entire app is migrated and stable on 6.0 before using this setting.
# Rails.application.config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob"
# Enable the same cache key to be reused when the object being cached of type
# `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count)
# of the relation's cache key into the cache version to support recycling cache key.
# Rails.application.config.active_record.collection_cache_versioning = true

View file

@ -1,6 +1,33 @@
# License: CC0-1.0 # Files in the config/locales directory are used for internationalization
# Sample localization file for English. Add more files in this directory for other locales. # and are automatically loaded by Rails. If you want to use locales other
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. # than English, add the necessary files in this directory.
#
# To use the locales, use `I18n.t`:
#
# I18n.t 'hello'
#
# In views, this is aliased to just `t`:
#
# <%= t('hello') %>
#
# To use a different locale, set it with `I18n.locale`:
#
# I18n.locale = :es
#
# This would use the information in config/locales/es.yml.
#
# The following keys must be escaped otherwise they will not be retrieved by
# the default I18n backend:
#
# true, false, on, off, yes, no
#
# Instead, surround them with single quotes.
#
# en:
# 'true': 'foo'
#
# To learn more, please read the Rails Internationalization guide
# available at https://guides.rubyonrails.org/i18n.html.
en: en:
hello: "Hello world" hello: "Hello world"
@ -10,8 +37,6 @@ en:
body: 'Comment content' body: 'Comment content'
organization: organization:
name: "Organisation" name: "Organisation"
organization_page:
promote: "Promote this organization"
donation: donation:
amount: "Total Amount" amount: "Total Amount"
date: "Transaction Date" date: "Transaction Date"
@ -29,9 +54,8 @@ en:
subject: "Donation receipt for %{nonprofit_name}" subject: "Donation receipt for %{nonprofit_name}"
transfer_info_html: "This transfer will appear on your bank statement as %{label}" transfer_info_html: "This transfer will appear on your bank statement as %{label}"
transfer_label_html: "<strong>Donation %{nonprofit_statement}</strong>." transfer_label_html: "<strong>Donation %{nonprofit_statement}</strong>."
oneoff_donation_html: "Your donation towards <strong>%{nonprofit_name}</strong> was successful!" oneoff_donation_html: "Thank you for your donation to <strong>%{nonprofit_name}</strong> and for joining thousands of people across Europe who are invested in making our movement a true force to be reckoned with. Your support will go towards ensuring we can move fast to win the campaigns that matter to all of us."
recurring_donation_html: "Your recurring donation towards <strong>%{nonprofit_name}</strong>, started on %{start_date}, has been successfully paid." recurring_donation_html: "Thank you for your regular donation to <strong>%{nonprofit_name}</strong> and for joining thousands of people across Europe who are invested in making our movement a true force to be reckoned with. Your support will go towards ensuring we can move fast to win the campaigns that matter to all of us."
recurring_donation_cancel_modify_html: "If you need to update your card or cancel your recurring donation, please follow this link: <a href=\"%{management_url}\">%{management_url}</a>"
donor_direct_debit_notification: donor_direct_debit_notification:
subject: "Donation receipt for %{nonprofit_name}" subject: "Donation receipt for %{nonprofit_name}"
transfer_info_html: "This transfer will appear on your bank statement as %{label}" transfer_info_html: "This transfer will appear on your bank statement as %{label}"
@ -142,61 +166,3 @@ en:
twitter: "Tweet" twitter: "Tweet"
twitter_message: "Join me in supporting" twitter_message: "Join me in supporting"
finish: "Finish" finish: "Finish"
registration:
get_started:
header: "Get started"
description: "Let's get started with Houdini. To begin, fill out your initial nonprofit and info."
wizard:
tabs:
nonprofit: "Nonprofit"
contact: "Contact"
nonprofit:
name:
label: "Organization Name"
placeholder: "Ending Poverty in the Fox Valley Inc."
website:
label: "Website URL"
placeholder: "http://www.endpovertyinthefoxvalleyinc.org"
email:
label: "Org Email (public)"
placeholder: "contact@endpovertyinthefoxvalleyinc.org"
phone:
label: "Org Phone (public)"
placeholder: "(555) 555-5555"
city:
label: "City"
placeholder: "Appleton"
state:
label: "State"
placeholder: "WI"
zip:
label: "Zip Code"
placeholder: "54915"
contact:
name:
label: "Your Name"
placeholder: "Penelope Schultz"
email:
label: "Your Email (used for login)"
placeholder: "penelope@endpovertyinthefoxvalleyinc.org"
password:
label: "New Password"
password_confirmation:
label: "Retype Password"
phone:
label: "Your Phone (for account recovery)"
placeholder: "(555) 555-5555"
save_and_finish: "Save & Finish"
saving: "Saving..."
next: "Next"
footer:
terms_and_privacy: "Terms & Privacy"
about: "About"
login:
header: "Login"
email: "Email"
password: "Password"
login: "Login"
logging_in: "Logging you in..."
forgot_password: "Forgot Password?"
get_started: "Get Started"

View file

@ -3,31 +3,40 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
# Puma can serve each request in a thread from an internal thread pool. # Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers a minimum and maximum. # The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match # Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum # the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum, this matches the default thread size of Active Record. # and maximum; this matches the default thread size of Active Record.
# #
threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }.to_i max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
threads threads_count, threads_count min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
port ENV.fetch("PORT") { 5000 }
# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }
# Specifies the `pidfile` that Puma will use.
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked web server processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
workers ENV.fetch("WEB_CONCURRENCY") { 2 } if ENV['RAILS_ENV'] != 'development'
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory.
#
preload_app! if ENV['RAILS_ENV'] != 'development' preload_app! if ENV['RAILS_ENV'] != 'development'
rackup DefaultRackup
port ENV.fetch('PORT') { 5000 }
environment ENV.fetch('RAILS_ENV') { 'development' }
workers Integer(ENV['WEB_CONCURRENCY'] || 1)
on_worker_boot do
# ActiveSupport.on_load(:active_record) do
# config = ActiveRecord::Base.configurations[Rails.env] ||
# Rails.application.config.database_configuration[Rails.env]
# config['pool'] = ENV['RAILS_MAX_THREADS'] || 1
# ActiveRecord::Base.establish_connection
# end
ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
end
# Allow puma to be restarted by `rails restart` command. # Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart plugin :tmp_restart

View file

@ -1,7 +1,34 @@
local:
service: Disk
root: <%= Rails.root.join("storage") %>
test: test:
service: Disk service: Disk
root: <%= Rails.root.join("tmp/storage") %> root: <%= Rails.root.join("tmp/storage") %>
local:
service: Disk
root: <%= Rails.root.join("storage") %>
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
# amazon:
# service: S3
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
# region: us-east-1
# bucket: your_own_bucket
# Remember not to checkin your GCS keyfile to a repository
# google:
# service: GCS
# project: your_project
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
# bucket: your_own_bucket
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
# microsoft:
# service: AzureStorage
# storage_account_name: your_account_name
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
# container: your_container_name
# mirror:
# service: Mirror
# primary: local
# mirrors: [ amazon, google, microsoft ]