From 230ab3079fd4e16ebaa593f6cc5fdbcbad3c2321 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 10 Dec 2022 12:32:44 -0500 Subject: Installed LINGO scoreboard --- Gemfile | 12 +- Gemfile.lock | 323 ++++++++++++--------- bin/rails | 11 +- bin/rake | 9 +- bin/setup | 31 +- config/application.rb | 2 +- config/boot.rb | 4 +- config/deploy.rb | 2 +- config/environment.rb | 2 +- config/environments/development.rb | 42 ++- config/environments/test.rb | 40 ++- config/initializers/content_security_policy.rb | 25 ++ config/initializers/filter_parameter_logging.rb | 8 +- config/initializers/inflections.rb | 8 +- config/initializers/lingo.rb | 1 + config/initializers/new_framework_defaults_7_0.rb | 135 +++++++++ config/initializers/permissions_policy.rb | 11 + config/lingo.yml | 4 + config/routes.rb | 1 + config/storage.yml | 34 +++ ..._name_to_active_storage_blobs.active_storage.rb | 22 ++ ...ctive_storage_variant_records.active_storage.rb | 27 ++ ...active_storage_blobs_checksum.active_storage.rb | 8 + .../20221210170549_create_lingo_scores.lingo.rb | 13 + db/schema.rb | 208 +++++++------ yarn.lock | 4 + 26 files changed, 691 insertions(+), 296 deletions(-) create mode 100644 config/initializers/content_security_policy.rb create mode 100644 config/initializers/lingo.rb create mode 100644 config/initializers/new_framework_defaults_7_0.rb create mode 100644 config/initializers/permissions_policy.rb create mode 100644 config/lingo.yml create mode 100644 config/storage.yml create mode 100644 db/migrate/20221210170526_add_service_name_to_active_storage_blobs.active_storage.rb create mode 100644 db/migrate/20221210170527_create_active_storage_variant_records.active_storage.rb create mode 100644 db/migrate/20221210170528_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb create mode 100644 db/migrate/20221210170549_create_lingo_scores.lingo.rb create mode 100644 yarn.lock diff --git a/Gemfile b/Gemfile index cbffc52..fa1a218 100644 --- a/Gemfile +++ b/Gemfile @@ -7,17 +7,18 @@ end # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 5.2.0' +gem 'rails', '~> 7.0.3' # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use Puma as the app server -gem 'puma', '>= 4.3.8' +#gem 'puma', '>= 6.0.0' +gem 'webrick', '~> 1.7' # Use SCSS for stylesheets gem 'sassc-rails' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # See https://github.com/rails/execjs#readme for more supported runtimes -gem 'node', platforms: :ruby +gem 'therubyracer', platforms: :ruby # Use CoffeeScript for .coffee assets and views gem 'coffee-rails', '~> 4.2' @@ -72,6 +73,7 @@ gem 'pokeviewer', github: "hatkirby/pokeviewer" gem 'acts-as-taggable-on' gem 'jquery-ui-rails' gem 'js-routes' -gem 'audited', '~> 4.7' +gem 'audited', '~> 5.0' gem 'enumerize' -gem 'sprockets', '3.7.2' \ No newline at end of file +gem 'sprockets', '3.7.2' +gem 'lingo', github: "hatkirby/lingo", glob: "rails/*.gemspec", branch: "main" \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index eea9708..6367d9e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,17 @@ +GIT + remote: https://github.com/hatkirby/lingo.git + revision: 787745956f13bb63c596ed80a53b386708b56508 + branch: main + glob: rails/*.gemspec + specs: + lingo (0.1.0) + haml-rails (~> 2.0) + rails (>= 7.0.3) + sassc-rails + GIT remote: https://github.com/hatkirby/pokeviewer.git - revision: 32d4d3c1fc54721c3c99a15415cf698475237984 + revision: e28f6b73ab7f2e59605ebd800e921a6146fc49ae specs: pokeviewer (0.1.0) activerecord-diff @@ -9,7 +20,7 @@ GIT haml jquery-rails normalize-rails - rails (~> 5.2.0) + rails (~> 7.0.3) sassc-rails sequenced victor @@ -17,71 +28,94 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (5.2.6) - actionpack (= 5.2.6) + actioncable (7.0.4) + actionpack (= 7.0.4) + activesupport (= 7.0.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.6) - actionpack (= 5.2.6) - actionview (= 5.2.6) - activejob (= 5.2.6) + actionmailbox (7.0.4) + actionpack (= 7.0.4) + activejob (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) + mail (>= 2.7.1) + net-imap + net-pop + net-smtp + actionmailer (7.0.4) + actionpack (= 7.0.4) + actionview (= 7.0.4) + activejob (= 7.0.4) + activesupport (= 7.0.4) mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp rails-dom-testing (~> 2.0) - actionpack (5.2.6) - actionview (= 5.2.6) - activesupport (= 5.2.6) - rack (~> 2.0, >= 2.0.8) + actionpack (7.0.4) + actionview (= 7.0.4) + activesupport (= 7.0.4) + rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.6) - activesupport (= 5.2.6) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (7.0.4) + actionpack (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.0.4) + activesupport (= 7.0.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.6) - activesupport (= 5.2.6) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (7.0.4) + activesupport (= 7.0.4) globalid (>= 0.3.6) - activemodel (5.2.6) - activesupport (= 5.2.6) - activerecord (5.2.6) - activemodel (= 5.2.6) - activesupport (= 5.2.6) - arel (>= 9.0) + activemodel (7.0.4) + activesupport (= 7.0.4) + activerecord (7.0.4) + activemodel (= 7.0.4) + activesupport (= 7.0.4) activerecord-diff (2.0.0) - activestorage (5.2.6) - actionpack (= 5.2.6) - activerecord (= 5.2.6) - marcel (~> 1.0.0) - activesupport (5.2.6) + activestorage (7.0.4) + actionpack (= 7.0.4) + activejob (= 7.0.4) + activerecord (= 7.0.4) + activesupport (= 7.0.4) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (7.0.4) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - acts-as-taggable-on (8.1.0) - activerecord (>= 5.0, < 6.2) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) - airbrussh (1.4.0) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + acts-as-taggable-on (9.0.1) + activerecord (>= 6.0, < 7.1) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) + airbrussh (1.4.1) sshkit (>= 1.6.1, != 1.7.0) - arel (9.0.0) - audited (4.10.0) - activerecord (>= 4.2, < 6.2) - bcrypt (3.1.16) + audited (5.0.2) + activerecord (>= 5.0, < 7.1) + bcrypt (3.1.18) bindex (0.8.1) builder (3.2.4) byebug (11.1.3) - capistrano (3.16.0) + capistrano (3.17.1) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) sshkit (>= 1.9.0) - capistrano-bundler (2.0.1) + capistrano-bundler (2.1.0) capistrano (~> 3.1) capistrano-passenger (0.2.1) capistrano (~> 3.0) - capistrano-rails (1.6.1) + capistrano-rails (1.6.2) capistrano (~> 3.1) capistrano-bundler (>= 1.1, < 3) capistrano-rvm (0.1.2) @@ -94,7 +128,6 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (>= 2.0, < 4.0) - childprocess (3.0.0) ckeditor (4.2.4) cocaine orm_adapter (~> 0.5.0) @@ -108,70 +141,84 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.9) + concurrent-ruby (1.1.10) crass (1.0.6) - devise (4.8.0) + date (3.3.1) + devise (4.8.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - enumerize (2.4.0) + enumerize (2.5.0) activesupport (>= 3.2) - erubi (1.10.0) + erubi (1.11.0) execjs (2.8.1) - ffi (1.15.3) - globalid (0.4.2) - activesupport (>= 4.2.0) - haml (5.2.1) - temple (>= 0.8.0) + ffi (1.15.5) + globalid (1.0.0) + activesupport (>= 5.0) + haml (6.1.1) + temple (>= 0.8.2) + thor tilt + haml-rails (2.1.0) + actionpack (>= 5.1) + activesupport (>= 5.1) + haml (>= 4.0.6) + railties (>= 5.1) highline (2.0.3) - i18n (1.8.10) + i18n (1.12.0) concurrent-ruby (~> 1.0) - jbuilder (2.11.2) + jbuilder (2.11.5) + actionview (>= 5.0.0) activesupport (>= 5.0.0) - jquery-rails (4.4.0) + jquery-rails (4.5.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) - js-routes (2.0.7) + js-routes (2.2.4) railties (>= 4) - listen (3.1.5) + libv8 (3.16.14.19) + listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - ruby_dep (~> 1.2) - loofah (2.10.0) + loofah (2.19.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.7.1) + mail (2.8.0) mini_mime (>= 0.1.1) - marcel (1.0.1) + net-imap + net-pop + net-smtp + marcel (1.0.2) method_source (1.0.0) - mime-types (3.3.1) + mime-types (3.4.1) mime-types-data (~> 3.2015) - mime-types-data (3.2021.0704) + mime-types-data (3.2022.0105) mimemagic (0.3.10) nokogiri (~> 1) rake - mini_mime (1.1.0) - mini_portile2 (2.5.3) - minitest (5.14.4) - mysql2 (0.5.3) - net-scp (3.0.0) - net-ssh (>= 2.6.5, < 7.0.0) - net-ssh (6.1.0) - nio4r (2.5.7) - node (2.1.0) - node_impl (~> 1.0.0) - node_int (~> 0.1.0) - node_impl (1.0.0) - node_int (~> 0.1.0) - node_int (0.1.3) - nokogiri (1.11.7) - mini_portile2 (~> 2.5.0) + mini_mime (1.1.2) + mini_portile2 (2.8.0) + minitest (5.16.3) + mysql2 (0.5.4) + net-imap (0.3.2) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout + net-scp (4.0.0) + net-ssh (>= 2.6.5, < 8.0.0) + net-smtp (0.3.3) + net-protocol + net-ssh (7.0.1) + nio4r (2.5.8) + nokogiri (1.13.10) + mini_portile2 (~> 2.8.0) racc (~> 1.4) normalize-rails (8.0.1) orm_adapter (0.5.0) @@ -181,45 +228,46 @@ GEM mime-types mimemagic (~> 0.3.0) terrapin (~> 0.6.0) - public_suffix (4.0.6) - puma (5.3.2) - nio4r (~> 2.0) - racc (1.5.2) - rack (2.2.3) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (5.2.6) - actioncable (= 5.2.6) - actionmailer (= 5.2.6) - actionpack (= 5.2.6) - actionview (= 5.2.6) - activejob (= 5.2.6) - activemodel (= 5.2.6) - activerecord (= 5.2.6) - activestorage (= 5.2.6) - activesupport (= 5.2.6) - bundler (>= 1.3.0) - railties (= 5.2.6) - sprockets-rails (>= 2.0.0) + public_suffix (5.0.1) + racc (1.6.1) + rack (2.2.4) + rack-test (2.0.2) + rack (>= 1.3) + rails (7.0.4) + actioncable (= 7.0.4) + actionmailbox (= 7.0.4) + actionmailer (= 7.0.4) + actionpack (= 7.0.4) + actiontext (= 7.0.4) + actionview (= 7.0.4) + activejob (= 7.0.4) + activemodel (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) + bundler (>= 1.15.0) + railties (= 7.0.4) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) + rails-html-sanitizer (1.4.3) loofah (~> 2.3) - railties (5.2.6) - actionpack (= 5.2.6) - activesupport (= 5.2.6) + railties (7.0.4) + actionpack (= 7.0.4) + activesupport (= 7.0.4) method_source - rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) + rake (>= 12.2) + thor (~> 1.0) + zeitwerk (~> 2.5) rake (13.0.6) - rb-fsevent (0.11.0) + rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) + ref (2.0.0) responders (3.0.1) actionpack (>= 5.0) railties (>= 5.0) - ruby_dep (1.5.0) + rexml (3.2.5) rubyzip (2.3.2) sassc (2.4.0) ffi (~> 1.9) @@ -229,10 +277,11 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (3.142.7) - childprocess (>= 0.5, < 4.0) - rubyzip (>= 1.2.2) - sequenced (3.2.0) + selenium-webdriver (4.7.1) + rexml (~> 3.2, >= 3.2.5) + rubyzip (>= 1.2.2, < 3.0) + websocket (~> 1.0) + sequenced (4.0.0) activerecord (>= 3.0) activesupport (>= 3.0) spring (2.1.1) @@ -242,47 +291,54 @@ GEM sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) sprockets (>= 3.0.0) - sqlite3 (1.4.2) - sshkit (1.21.2) + sqlite3 (1.5.4) + mini_portile2 (~> 2.8.0) + sshkit (1.21.3) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) - temple (0.8.2) + temple (0.9.1) terrapin (0.6.0) climate_control (>= 0.0.3, < 1.0) - thor (1.1.0) - thread_safe (0.3.6) - tilt (2.0.10) + therubyracer (0.12.3) + libv8 (~> 3.16.14.15) + ref + thor (1.2.1) + tilt (2.0.11) + timeout (0.3.1) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) - tzinfo (1.2.9) - thread_safe (~> 0.1) + tzinfo (2.0.5) + concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) - victor (0.3.3) + victor (0.3.4) warden (1.2.9) rack (>= 2.0.9) - web-console (3.7.0) - actionview (>= 5.0) - activemodel (>= 5.0) + web-console (4.2.0) + actionview (>= 6.0.0) + activemodel (>= 6.0.0) bindex (>= 0.4.0) - railties (>= 5.0) + railties (>= 6.0.0) + webrick (1.7.0) + websocket (1.2.9) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) + zeitwerk (2.6.6) PLATFORMS ruby DEPENDENCIES acts-as-taggable-on - audited (~> 4.7) + audited (~> 5.0) byebug capistrano (~> 3.0) capistrano-bundler @@ -300,24 +356,25 @@ DEPENDENCIES jquery-rails jquery-ui-rails js-routes + lingo! listen (>= 3.0.5, < 3.2) mysql2 - node normalize-rails paperclip pokeviewer! - puma (>= 4.3.8) - rails (~> 5.2.0) + rails (~> 7.0.3) sassc-rails selenium-webdriver spring spring-watcher-listen (~> 2.0.0) sprockets (= 3.7.2) sqlite3 + therubyracer turbolinks (~> 5) tzinfo-data uglifier (>= 1.3.0) web-console (>= 3.3.0) + webrick (~> 1.7) BUNDLED WITH 2.2.3 diff --git a/bin/rails b/bin/rails index 5badb2f..efc0377 100755 --- a/bin/rails +++ b/bin/rails @@ -1,9 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError => e - raise unless e.message.include?('spring') -end -APP_PATH = File.expand_path('../config/application', __dir__) -require_relative '../config/boot' -require 'rails/commands' +APP_PATH = File.expand_path("../config/application", __dir__) +require_relative "../config/boot" +require "rails/commands" diff --git a/bin/rake b/bin/rake index d87d5f5..4fbf10b 100755 --- a/bin/rake +++ b/bin/rake @@ -1,9 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError => e - raise unless e.message.include?('spring') -end -require_relative '../config/boot' -require 'rake' +require_relative "../config/boot" +require "rake" Rake.application.run diff --git a/bin/setup b/bin/setup index 78c4e86..ec47b79 100755 --- a/bin/setup +++ b/bin/setup @@ -1,38 +1,33 @@ #!/usr/bin/env ruby -require 'pathname' -require 'fileutils' -include FileUtils +require "fileutils" # path to your application root. -APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) +APP_ROOT = File.expand_path("..", __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end -chdir APP_ROOT do - # This script is a starting point to setup your application. +FileUtils.chdir APP_ROOT do + # This script is a way to set up or update your development environment automatically. + # 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. - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') - - # Install JavaScript dependencies if using Yarn - # system('bin/yarn') - + puts "== Installing dependencies ==" + system! "gem install bundler --conservative" + system("bundle check") || system!("bundle install") # puts "\n== Copying sample files ==" - # unless File.exist?('config/database.yml') - # cp 'config/database.yml.sample', 'config/database.yml' + # unless File.exist?("config/database.yml") + # FileUtils.cp "config/database.yml.sample", "config/database.yml" # end puts "\n== Preparing database ==" - system! 'bin/rails db:setup' + system! "bin/rails db:prepare" 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 ==" - system! 'bin/rails restart' + system! "bin/rails restart" end diff --git a/config/application.rb b/config/application.rb index f909eaa..e855cbf 100644 --- a/config/application.rb +++ b/config/application.rb @@ -9,7 +9,7 @@ Bundler.require(*Rails.groups) module Thoughts class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 5.1 + config.load_defaults Rails::VERSION::STRING.to_f # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers diff --git a/config/boot.rb b/config/boot.rb index 30f5120..2820116 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,3 @@ -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. diff --git a/config/deploy.rb b/config/deploy.rb index 3843db6..db44532 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -21,7 +21,7 @@ set :deploy_to, "/srv/www/thoughts" # set :pty, true # Default value for :linked_files is [] -append :linked_files, "config/database.yml", "config/secrets.yml" +append :linked_files, "config/database.yml", "config/secrets.yml", "config/lingo.yml" # Default value for linked_dirs is [] append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/uploads" diff --git a/config/environment.rb b/config/environment.rb index 426333b..cac5315 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,5 @@ # Load the Rails application. -require_relative 'application' +require_relative "application" # Initialize the Rails application. Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 1b0c4b3..8500f45 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,8 +1,10 @@ +require "active_support/core_ext/integer/time" + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development + # In the development environment your application's code is reloaded any time + # it changes. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false @@ -12,13 +14,18 @@ Rails.application.configure do # Show full error reports. config.consider_all_requests_local = true + # Enable server timing + config.server_timing = true + # 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.enable_fragment_cache_logging = true config.cache_store = :memory_store config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}" + "Cache-Control" => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false @@ -26,6 +33,9 @@ Rails.application.configure do config.cache_store = :null_store end + # Store uploaded files on the local file system (see config/storage.yml for options). + config.active_storage.service = :local + # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false @@ -34,23 +44,27 @@ Rails.application.configure do # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load - # 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 + # Highlight code that triggered database queries in logs. + config.active_record.verbose_query_logs = true # Suppress logger output for asset requests. config.assets.quiet = true - # Raises error for missing translations - # config.action_view.raise_on_missing_translations = true + # Raises error for missing translations. + # config.i18n.raise_on_missing_translations = 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 + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true - config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } + # Uncomment if you wish to allow Action Cable access from any origin. + # config.action_cable.disable_request_forgery_protection = true end diff --git a/config/environments/test.rb b/config/environments/test.rb index 8e5cbde..6ea4d1e 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,32 +1,41 @@ +require "active_support/core_ext/integer/time" + +# 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! + Rails.application.configure do # 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! + # Turn false under Spring and add config.action_view.cache_template_loading = true. config.cache_classes = true - # Do not eager load code on boot. This avoids loading your whole application - # just for the purpose of running a single test. If you are using a tool that - # preloads Rails for running tests, you may have to set it to true. - config.eager_load = false + # Eager loading loads your whole application. When running a single test locally, + # this probably isn't necessary. It's a good idea to do in a continuous integration + # system, or in some way before deploying your code. + config.eager_load = ENV["CI"].present? # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}" + "Cache-Control" => "public, max-age=#{1.hour.to_i}" } # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false + config.cache_store = :null_store # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false # Disable request forgery protection in test environment. 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 # Tell Action Mailer not to deliver emails to the real world. @@ -37,6 +46,15 @@ Rails.application.configure do # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr - # Raises error for missing translations - # config.action_view.raise_on_missing_translations = true + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + + # Raises error for missing translations. + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true end diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb new file mode 100644 index 0000000..54f47cf --- /dev/null +++ b/config/initializers/content_security_policy.rb @@ -0,0 +1,25 @@ +# Be sure to restart your server when you modify this file. + +# Define an application-wide content security policy. +# See the Securing Rails Applications Guide for more information: +# https://guides.rubyonrails.org/security.html#content-security-policy-header + +# Rails.application.configure do +# 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 +# +# # Generate session nonces for permitted importmap and inline scripts +# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } +# config.content_security_policy_nonce_directives = %w(script-src) +# +# # Report violations without enforcing the policy. +# # config.content_security_policy_report_only = true +# end diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 4a994e1..adc6568 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,4 +1,8 @@ # Be sure to restart your server when you modify this file. -# Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += [:password] +# Configure parameters to be filtered from the log file. Use this to limit dissemination of +# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported +# notations and behaviors. +Rails.application.config.filter_parameters += [ + :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn +] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index ac033bf..3860f65 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -4,13 +4,13 @@ # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' +# inflect.plural /^(ox)$/i, "\\1en" +# inflect.singular /^(ox)en/i, "\\1" +# inflect.irregular "person", "people" # inflect.uncountable %w( fish sheep ) # end # These inflection rules are supported but not enabled by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.acronym 'RESTful' +# inflect.acronym "RESTful" # end diff --git a/config/initializers/lingo.rb b/config/initializers/lingo.rb new file mode 100644 index 0000000..edb76d8 --- /dev/null +++ b/config/initializers/lingo.rb @@ -0,0 +1 @@ +Lingo.secret_code = Rails.application.config_for(:lingo)[:secret_code] \ No newline at end of file diff --git a/config/initializers/new_framework_defaults_7_0.rb b/config/initializers/new_framework_defaults_7_0.rb new file mode 100644 index 0000000..4d58024 --- /dev/null +++ b/config/initializers/new_framework_defaults_7_0.rb @@ -0,0 +1,135 @@ +# Be sure to restart your server when you modify this file. +# +# This file eases your Rails 7.0 framework defaults upgrade. +# +# Uncomment each configuration one by one to switch to the new default. +# Once your application is ready to run with all new defaults, you can remove +# this file and set the `config.load_defaults` to `7.0`. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. +# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html + +# `button_to` view helper will render `