1
0
mirror of https://github.com/projekteuler/projekteuler.git synced 2025-12-10 08:46:41 +01:00

Merge pull request #252 from projekteuler/rails-7.0

Upgrade to rails 7.0
This commit is contained in:
Philipp Fischbeck 2022-02-20 20:42:59 +01:00 committed by GitHub
commit 946d848737
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 209 additions and 193 deletions

View File

@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
ruby: ['2.6', '2.7', '3.0'] ruby: ['2.7', '3.0', '3.1']
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Ruby ${{ matrix.ruby }} - name: Set up Ruby ${{ matrix.ruby }}

View File

@ -2,7 +2,7 @@ source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '6.1.4.1' gem 'rails', '7.0.1'
# Use Puma as the app server # Use Puma as the app server
gem 'puma', '~> 5.5' gem 'puma', '~> 5.5'
# Use sqlite3 as the database for Active Record # Use sqlite3 as the database for Active Record
@ -21,7 +21,7 @@ gem 'coffee-rails', '~> 5.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes # See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby # gem 'therubyracer', platforms: :ruby
gem 'rails-i18n', '~> 6.0.0' gem 'rails-i18n', '~> 7.0.1'
gem 'rails-controller-testing' gem 'rails-controller-testing'
@ -69,3 +69,8 @@ gem 'omniauth-github'
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw] gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
# Silence net protocol warnings
# See https://github.com/rails/rails/pull/44175
gem 'net-http'
gem 'uri', '0.10.0'

View File

@ -1,73 +1,79 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (6.1.4.1) actioncable (7.0.1)
actionpack (= 6.1.4.1) actionpack (= 7.0.1)
activesupport (= 6.1.4.1) activesupport (= 7.0.1)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailbox (6.1.4.1) actionmailbox (7.0.1)
actionpack (= 6.1.4.1) actionpack (= 7.0.1)
activejob (= 6.1.4.1) activejob (= 7.0.1)
activerecord (= 6.1.4.1) activerecord (= 7.0.1)
activestorage (= 6.1.4.1) activestorage (= 7.0.1)
activesupport (= 6.1.4.1) activesupport (= 7.0.1)
mail (>= 2.7.1) mail (>= 2.7.1)
actionmailer (6.1.4.1) net-imap
actionpack (= 6.1.4.1) net-pop
actionview (= 6.1.4.1) net-smtp
activejob (= 6.1.4.1) actionmailer (7.0.1)
activesupport (= 6.1.4.1) actionpack (= 7.0.1)
actionview (= 7.0.1)
activejob (= 7.0.1)
activesupport (= 7.0.1)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (6.1.4.1) actionpack (7.0.1)
actionview (= 6.1.4.1) actionview (= 7.0.1)
activesupport (= 6.1.4.1) activesupport (= 7.0.1)
rack (~> 2.0, >= 2.0.9) rack (~> 2.0, >= 2.2.0)
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.2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.4.1) actiontext (7.0.1)
actionpack (= 6.1.4.1) actionpack (= 7.0.1)
activerecord (= 6.1.4.1) activerecord (= 7.0.1)
activestorage (= 6.1.4.1) activestorage (= 7.0.1)
activesupport (= 6.1.4.1) activesupport (= 7.0.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
actionview (6.1.4.1) actionview (7.0.1)
activesupport (= 6.1.4.1) activesupport (= 7.0.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.1, >= 1.2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.4.1) activejob (7.0.1)
activesupport (= 6.1.4.1) activesupport (= 7.0.1)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (6.1.4.1) activemodel (7.0.1)
activesupport (= 6.1.4.1) activesupport (= 7.0.1)
activerecord (6.1.4.1) activerecord (7.0.1)
activemodel (= 6.1.4.1) activemodel (= 7.0.1)
activesupport (= 6.1.4.1) activesupport (= 7.0.1)
activestorage (6.1.4.1) activestorage (7.0.1)
actionpack (= 6.1.4.1) actionpack (= 7.0.1)
activejob (= 6.1.4.1) activejob (= 7.0.1)
activerecord (= 6.1.4.1) activerecord (= 7.0.1)
activesupport (= 6.1.4.1) activesupport (= 7.0.1)
marcel (~> 1.0.0) marcel (~> 1.0)
mini_mime (>= 1.1.0) mini_mime (>= 1.1.0)
activesupport (6.1.4.1) activesupport (7.0.1)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
minitest (>= 5.1) minitest (>= 5.1)
tzinfo (~> 2.0) tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.0) addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0) public_suffix (>= 2.0.2, < 5.0)
autoprefixer-rails (10.3.3.0) autoprefixer-rails (10.4.2.0)
execjs (~> 2) execjs (~> 2)
bcrypt (3.1.16) bcrypt (3.1.16)
bindex (0.8.1) bindex (0.8.1)
bootsnap (1.9.3) bootsnap (1.10.2)
msgpack (~> 1.0) msgpack (~> 1.2)
bootstrap (5.1.3) bootstrap (5.1.3)
autoprefixer-rails (>= 9.1.0) autoprefixer-rails (>= 9.1.0)
popper_js (>= 2.9.3, < 3) popper_js (>= 2.9.3, < 3)
@ -87,42 +93,59 @@ GEM
crack (0.4.5) crack (0.4.5)
rexml rexml
crass (1.0.6) crass (1.0.6)
devise (4.8.0) devise (4.8.1)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 4.1.0) railties (>= 4.1.0)
responders responders
warden (~> 1.2.3) warden (~> 1.2.3)
diff-lcs (1.4.4) diff-lcs (1.5.0)
diffy (3.4.0) diffy (3.4.0)
digest (3.1.0)
erubi (1.10.0) erubi (1.10.0)
execjs (2.8.1) execjs (2.8.1)
faraday (1.4.1) faraday (1.9.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1) faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0) faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.1) faraday-net_http_persistent (~> 1.0)
multipart-post (>= 1.2, < 3) faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4) ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0) faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.3)
multipart-post (>= 1.2, < 3)
faraday-net_http (1.0.1) faraday-net_http (1.0.1)
faraday-net_http_persistent (1.1.0) faraday-net_http_persistent (1.2.0)
ffi (1.15.4) faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
ffi (1.15.5)
font-awesome-sass (5.15.1) font-awesome-sass (5.15.1)
sassc (>= 1.11) sassc (>= 1.11)
globalid (0.5.2) globalid (1.0.0)
activesupport (>= 5.0) activesupport (>= 5.0)
hashdiff (1.0.1) hashdiff (1.0.1)
hashie (4.1.0) hashie (5.0.0)
i18n (1.8.11) i18n (1.9.1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
jbuilder (2.11.3) io-wait (0.2.1)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
jquery-rails (4.4.0) jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3) rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0) railties (>= 4.2.0)
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
jwt (2.2.3) jwt (2.3.0)
listen (3.7.0) listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10) rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.13.0) loofah (2.13.0)
@ -132,17 +155,35 @@ GEM
mini_mime (>= 0.1.1) mini_mime (>= 0.1.1)
marcel (1.0.2) marcel (1.0.2)
method_source (1.0.0) method_source (1.0.0)
mini_mime (1.1.1) mini_mime (1.1.2)
mini_portile2 (2.6.1) mini_portile2 (2.7.1)
minitest (5.15.0) minitest (5.15.0)
msgpack (1.4.2) msgpack (1.4.4)
multi_json (1.15.0) multi_json (1.15.0)
multi_xml (0.6.0) multi_xml (0.6.0)
multipart-post (2.1.1) multipart-post (2.1.1)
mysql2 (0.5.3) mysql2 (0.5.3)
net-http (0.2.0)
net-protocol
uri
net-imap (0.2.3)
digest
net-protocol
strscan
net-pop (0.1.1)
digest
net-protocol
timeout
net-protocol (0.1.2)
io-wait
timeout
net-smtp (0.3.1)
digest
net-protocol
timeout
nio4r (2.5.8) nio4r (2.5.8)
nokogiri (1.12.5) nokogiri (1.13.1)
mini_portile2 (~> 2.6.1) mini_portile2 (~> 2.7.0)
racc (~> 1.4) racc (~> 1.4)
oauth2 (1.4.7) oauth2 (1.4.7)
faraday (>= 0.8, < 2.0) faraday (>= 0.8, < 2.0)
@ -157,7 +198,7 @@ GEM
omniauth-github (2.0.0) omniauth-github (2.0.0)
omniauth (~> 2.0) omniauth (~> 2.0)
omniauth-oauth2 (~> 1.7.1) omniauth-oauth2 (~> 1.7.1)
omniauth-oauth2 (1.7.1) omniauth-oauth2 (1.7.2)
oauth2 (~> 1.4) oauth2 (~> 1.4)
omniauth (>= 1.9, < 3) omniauth (>= 1.9, < 3)
omniauth-rails_csrf_protection (1.0.0) omniauth-rails_csrf_protection (1.0.0)
@ -165,8 +206,10 @@ GEM
omniauth (~> 2.0) omniauth (~> 2.0)
orm_adapter (0.5.0) orm_adapter (0.5.0)
popper_js (2.9.3) popper_js (2.9.3)
psych (4.0.3)
stringio
public_suffix (4.0.6) public_suffix (4.0.6)
puma (5.5.2) puma (5.6.1)
nio4r (~> 2.0) nio4r (~> 2.0)
racc (1.6.0) racc (1.6.0)
rack (2.2.3) rack (2.2.3)
@ -174,21 +217,20 @@ GEM
rack rack
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rails (6.1.4.1) rails (7.0.1)
actioncable (= 6.1.4.1) actioncable (= 7.0.1)
actionmailbox (= 6.1.4.1) actionmailbox (= 7.0.1)
actionmailer (= 6.1.4.1) actionmailer (= 7.0.1)
actionpack (= 6.1.4.1) actionpack (= 7.0.1)
actiontext (= 6.1.4.1) actiontext (= 7.0.1)
actionview (= 6.1.4.1) actionview (= 7.0.1)
activejob (= 6.1.4.1) activejob (= 7.0.1)
activemodel (= 6.1.4.1) activemodel (= 7.0.1)
activerecord (= 6.1.4.1) activerecord (= 7.0.1)
activestorage (= 6.1.4.1) activestorage (= 7.0.1)
activesupport (= 6.1.4.1) activesupport (= 7.0.1)
bundler (>= 1.15.0) bundler (>= 1.15.0)
railties (= 6.1.4.1) railties (= 7.0.1)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.5) rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1) actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1)
@ -198,25 +240,27 @@ GEM
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.4.2) rails-html-sanitizer (1.4.2)
loofah (~> 2.3) loofah (~> 2.3)
rails-i18n (6.0.0) rails-i18n (7.0.1)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 7) railties (>= 6.0.0, < 8)
railties (6.1.4.1) railties (7.0.1)
actionpack (= 6.1.4.1) actionpack (= 7.0.1)
activesupport (= 6.1.4.1) activesupport (= 7.0.1)
method_source method_source
rake (>= 0.13) rake (>= 12.2)
thor (~> 1.0) thor (~> 1.0)
zeitwerk (~> 2.5)
rake (13.0.6) rake (13.0.6)
rb-fsevent (0.11.0) rb-fsevent (0.11.0)
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
rdoc (6.3.1) rdoc (6.4.0)
psych (>= 4.0.0)
responders (3.0.1) responders (3.0.1)
actionpack (>= 5.0) actionpack (>= 5.0)
railties (>= 5.0) railties (>= 5.0)
rexml (3.2.5) rexml (3.2.5)
ruby2_keywords (0.0.4) ruby2_keywords (0.0.5)
sassc (2.4.0) sassc (2.4.0)
ffi (~> 1.9) ffi (~> 1.9)
sassc-rails (2.1.2) sassc-rails (2.1.2)
@ -230,13 +274,16 @@ GEM
sprockets (4.0.2) sprockets (4.0.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-rails (3.4.1) sprockets-rails (3.4.2)
actionpack (>= 5.2) actionpack (>= 5.2)
activesupport (>= 5.2) activesupport (>= 5.2)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sqlite3 (1.4.2) sqlite3 (1.4.2)
thor (1.1.0) stringio (3.0.1)
strscan (3.0.1)
thor (1.2.1)
tilt (2.0.10) tilt (2.0.10)
timeout (0.2.0)
turbolinks (5.2.1) turbolinks (5.2.1)
turbolinks-source (~> 5.2) turbolinks-source (~> 5.2)
turbolinks-source (5.2.0) turbolinks-source (5.2.0)
@ -244,6 +291,7 @@ GEM
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
uglifier (4.2.0) uglifier (4.2.0)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
uri (0.10.0)
warden (1.2.9) warden (1.2.9)
rack (>= 2.0.9) rack (>= 2.0.9)
web-console (4.2.0) web-console (4.2.0)
@ -261,7 +309,7 @@ GEM
will_paginate (3.3.1) will_paginate (3.3.1)
will_paginate-bootstrap4 (0.2.2) will_paginate-bootstrap4 (0.2.2)
will_paginate (~> 3.0, >= 3.0.0) will_paginate (~> 3.0, >= 3.0.0)
zeitwerk (2.5.1) zeitwerk (2.5.4)
PLATFORMS PLATFORMS
ruby ruby
@ -279,23 +327,25 @@ DEPENDENCIES
jquery-rails (~> 4.4.0) jquery-rails (~> 4.4.0)
listen (~> 3.7.0) listen (~> 3.7.0)
mysql2 (~> 0.5.2) mysql2 (~> 0.5.2)
net-http
omniauth omniauth
omniauth-github omniauth-github
omniauth-rails_csrf_protection omniauth-rails_csrf_protection
puma (~> 5.5) puma (~> 5.5)
rails (= 6.1.4.1) rails (= 7.0.1)
rails-controller-testing rails-controller-testing
rails-i18n (~> 6.0.0) rails-i18n (~> 7.0.1)
sassc-rails (~> 2.1.2) sassc-rails (~> 2.1.2)
sdoc (~> 2.2.0) sdoc (~> 2.2.0)
sqlite3 (~> 1.4.1) sqlite3 (~> 1.4.1)
turbolinks (~> 5.2.1) turbolinks (~> 5.2.1)
tzinfo-data tzinfo-data
uglifier (~> 4.2.0) uglifier (~> 4.2.0)
uri (= 0.10.0)
web-console (~> 4.2.0) web-console (~> 4.2.0)
webmock webmock
will_paginate (~> 3.3.1) will_paginate (~> 3.3.1)
will_paginate-bootstrap4 (~> 0.2.2) will_paginate-bootstrap4 (~> 0.2.2)
BUNDLED WITH BUNDLED WITH
2.2.17 2.2.32

View File

@ -1,4 +1,4 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
APP_PATH = File.expand_path('../config/application', __dir__) APP_PATH = File.expand_path("../config/application", __dir__)
require_relative "../config/boot" require_relative "../config/boot"
require "rails/commands" require "rails/commands"

View File

@ -2,7 +2,7 @@
require "fileutils" require "fileutils"
# path to your application root. # path to your application root.
APP_ROOT = 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 ==")
@ -13,24 +13,21 @@ FileUtils.chdir APP_ROOT do
# This script is idempotent, so that you can run it at any time and get an expectable outcome. # This script is idempotent, so that you can run it at any time 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 =="
system! 'gem install bundler --conservative' system! "gem install bundler --conservative"
system('bundle check') || system!('bundle install') system("bundle check") || system!("bundle install")
# Install JavaScript dependencies
# system! 'bin/yarn'
# puts "\n== Copying sample files ==" # puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml') # unless File.exist?("config/database.yml")
# FileUtils.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:prepare' 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"
puts "\n== Restarting application server ==" puts "\n== Restarting application server =="
system! 'bin/rails restart' system! "bin/rails restart"
end end

View File

@ -9,7 +9,7 @@ Bundler.require(*Rails.groups)
module Projekteuler module Projekteuler
class Application < Rails::Application class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version. # Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.1 config.load_defaults 7.0
# Configuration for the application, engines, and railties goes here. # Configuration for the application, engines, and railties goes here.
# #
@ -27,7 +27,8 @@ module Projekteuler
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
config.time_zone = 'Berlin' config.time_zone = "Berlin"
# config.eager_load_paths << Rails.root.join("extras")
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s] config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]

View File

@ -1,4 +1,4 @@
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile. require "bundler/setup" # Set up gems listed in the Gemfile.
require "bootsnap/setup" # Speed up boot time by caching expensive operations. require "bootsnap/setup" # Speed up boot time by caching expensive operations.

View File

@ -14,15 +14,18 @@ Rails.application.configure do
# Show full error reports. # Show full error reports.
config.consider_all_requests_local = true config.consider_all_requests_local = true
# Enable server timing
config.server_timing = true
# Enable/disable caching. By default caching is disabled. # Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching. # Run rails dev:cache to toggle caching.
if Rails.root.join('tmp', 'caching-dev.txt').exist? 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.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=#{2.days.to_i}" "Cache-Control" => "public, max-age=#{2.days.to_i}"
} }
else else
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
@ -53,11 +56,6 @@ Rails.application.configure do
# Highlight code that triggered database queries in logs. # Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true config.active_record.verbose_query_logs = true
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Suppress logger output for asset requests. # Suppress logger output for asset requests.
config.assets.quiet = true config.assets.quiet = true
@ -67,10 +65,6 @@ Rails.application.configure do
# Annotate rendered view with file names. # Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true # config.action_view.annotate_rendered_view_with_filenames = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Uncomment if you wish to allow Action Cable access from any origin. # Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true # config.action_cable.disable_request_forgery_protection = true
end end

View File

@ -22,11 +22,8 @@ Rails.application.configure do
# Disable serving static files from the `/public` folder by default since # 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 JS using a preprocessor.
config.assets.js_compressor = Uglifier.new(harmony: true)
# Compress CSS using a preprocessor. # Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass # config.assets.css_compressor = :sass
@ -34,19 +31,19 @@ Rails.application.configure do
config.assets.compile = false config.assets.compile = false
# Enable serving of images, stylesheets, and JavaScripts from an asset server. # Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.asset_host = 'http://assets.example.com' # config.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). # Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local config.active_storage.service = :local
# Mount Action Cable outside main process or domain. # Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil # config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable' # config.action_cable.url = "wss://example.com/cable"
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
# 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
@ -75,21 +72,15 @@ Rails.application.configure do
# the I18n.default_locale when a translation cannot be found). # the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true config.i18n.fallbacks = true
# Send deprecation notices to registered listeners. # Log deprecations.
config.active_support.deprecation = :notify config.active_support.report_deprecations = true
# Log disallowed deprecations.
config.active_support.disallowed_deprecation = :log
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Use default logging formatter so that PID and timestamp are not suppressed. # Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups. # Use a different logger for distributed setups.
# 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)
@ -99,25 +90,4 @@ Rails.application.configure do
# 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,3 +1,5 @@
require "active_support/core_ext/integer/time"
# The test environment is used exclusively to run your application's # The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that # 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 # your test database is "scratch space" for the test suite and is wiped
@ -6,17 +8,18 @@
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.
# Turn false under Spring and add config.action_view.cache_template_loading = true.
config.cache_classes = true config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application # Eager loading loads your whole application. When running a single test locally,
# just for the purpose of running a single test. If you are using a tool that # this probably isn't necessary. It's a good idea to do in a continuous integration
# preloads Rails for running tests, you may have to set it to true. # system, or in some way before deploying your code.
config.eager_load = false config.eager_load = ENV["CI"].present?
# 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=#{1.hour.to_i}" "Cache-Control" => "public, max-age=#{1.hour.to_i}"
} }
# Show full error reports and disable caching. # Show full error reports and disable caching.

View File

@ -1,12 +1,10 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets. # Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0' Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path. # Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path # Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules folder to the asset load path.
Rails.application.config.assets.paths << Rails.root.join('node_modules')
# Precompile additional assets. # Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets # application.js, application.css, and all non-JS/CSS in the app/assets

View File

@ -4,26 +4,24 @@
# For further information see the following documentation # For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
Rails.application.config.content_security_policy do |policy| Rails.application.configure do
policy.default_src :none config.content_security_policy do |policy|
policy.font_src :self, 'https://cdnjs.cloudflare.com' policy.default_src :none
policy.img_src :self, 'https://cdnjs.cloudflare.com', 'https://projecteuler.net' policy.font_src :self, "https://cdnjs.cloudflare.com"
policy.object_src :none policy.img_src :self, "https://cdnjs.cloudflare.com", "https://projecteuler.net"
policy.script_src :self, 'https://cdnjs.cloudflare.com' policy.object_src :none
policy.style_src :self, :unsafe_inline policy.script_src :self, "https://cdnjs.cloudflare.com"
policy.connect_src :self policy.style_src :self, :unsafe_inline
policy.connect_src :self
# Specify URI for violation reports
# policy.report_uri "/csp-violation-report-endpoint"
end
# Specify URI for violation reports # Generate session nonces for permitted importmap and inline scripts
# policy.report_uri "/csp-violation-report-endpoint" config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
config.content_security_policy_nonce_directives = %w(script-src)
# Report CSP violations to a specified URI. See:
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
# config.content_security_policy_report_only = true
end 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

@ -4,13 +4,13 @@
# are locale specific, and you may define rules for as many different # are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default: # locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect| # ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en' # inflect.plural /^(ox)$/i, "\\1en"
# inflect.singular /^(ox)en/i, '\1' # inflect.singular /^(ox)en/i, "\\1"
# inflect.irregular 'person', 'people' # inflect.irregular "person", "people"
# inflect.uncountable %w( fish sheep ) # inflect.uncountable %w( fish sheep )
# end # end
# These inflection rules are supported but not enabled by default: # These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect| # ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful' # inflect.acronym "RESTful"
# end # end