diff --git a/Gemfile b/Gemfile index 971b00b731..5853db9d49 100644 --- a/Gemfile +++ b/Gemfile @@ -6,8 +6,8 @@ git_source(:github) do |repo_name| end # Rails framework -gem 'rails', '~> 5.2' -gem 'rails-i18n', '~> 5' +gem 'rails', '6.0.6.1' +gem 'rails-i18n' # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', require: false @@ -35,10 +35,10 @@ gem 'lev', '~> 10.1.0' gem 'bootstrap-sass', '~> 3.4.1' # SCSS stylesheets -gem 'sass-rails', '~> 5.0' +gem 'sass-rails' # Compass stylesheets -gem 'compass-rails', '~> 3.1.0' +gem 'compass-rails' # CoffeeScript for .js.coffee assets and views gem 'coffee-rails', '5.0.0' @@ -151,10 +151,10 @@ gem 'awesome_print' gem 'whenever', require: false # Admin toggles -gem 'rails-settings-ui' +# gem 'rails-settings-ui', '1.3.4' -gem 'rails-settings-cached', '0.7.2' -gem 'dry-validation', '0.12.3' +# gem 'rails-settings-cached', '0.7.2' +# gem 'dry-validation' # Respond to ELB healthchecks in /ping and /ping/ gem 'openstax_healthcheck' diff --git a/Gemfile.lock b/Gemfile.lock index af3b1458ed..e6ae66cc45 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,123 +29,143 @@ GEM action_interceptor (1.2.0) addressable rails (>= 3.1) - actioncable (5.2.8.1) - actionpack (= 5.2.8.1) + actioncable (6.0.6.1) + actionpack (= 6.0.6.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.8.1) - actionpack (= 5.2.8.1) - actionview (= 5.2.8.1) - activejob (= 5.2.8.1) + actionmailbox (6.0.6.1) + actionpack (= 6.0.6.1) + activejob (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) + mail (>= 2.7.1) + actionmailer (6.0.6.1) + actionpack (= 6.0.6.1) + actionview (= 6.0.6.1) + activejob (= 6.0.6.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.8.1) - actionview (= 5.2.8.1) - activesupport (= 5.2.8.1) + actionpack (6.0.6.1) + actionview (= 6.0.6.1) + activesupport (= 6.0.6.1) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.8.1) - activesupport (= 5.2.8.1) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.6.1) + actionpack (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) + nokogiri (>= 1.8.5) + actionview (6.0.6.1) + activesupport (= 6.0.6.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - active_attr (0.16.0) - actionpack (>= 3.0.2, < 7.2) - activemodel (>= 3.0.2, < 7.2) - activesupport (>= 3.0.2, < 7.2) - activejob (5.2.8.1) - activesupport (= 5.2.8.1) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + active_attr (0.17.0) + actionpack (>= 3.0.2, < 8.0) + activemodel (>= 3.0.2, < 8.0) + activesupport (>= 3.0.2, < 8.0) + activejob (6.0.6.1) + activesupport (= 6.0.6.1) globalid (>= 0.3.6) - activemodel (5.2.8.1) - activesupport (= 5.2.8.1) - activerecord (5.2.8.1) - activemodel (= 5.2.8.1) - activesupport (= 5.2.8.1) - arel (>= 9.0) - activerecord-import (1.0.8) - activerecord (>= 3.2) - activestorage (5.2.8.1) - actionpack (= 5.2.8.1) - activerecord (= 5.2.8.1) - marcel (~> 1.0.0) - activesupport (5.2.8.1) + activemodel (6.0.6.1) + activesupport (= 6.0.6.1) + activerecord (6.0.6.1) + activemodel (= 6.0.6.1) + activesupport (= 6.0.6.1) + activerecord-import (1.8.1) + activerecord (>= 4.2) + activestorage (6.0.6.1) + actionpack (= 6.0.6.1) + activejob (= 6.0.6.1) + activerecord (= 6.0.6.1) + marcel (~> 1.0) + activesupport (6.0.6.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) + zeitwerk (~> 2.2, >= 2.2.2) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) aes_key_wrap (1.1.0) - apipie-rails (0.5.16) - rails (>= 4.1) - arel (9.0.0) + apipie-rails (1.4.2) + actionpack (>= 5.0) + activesupport (>= 5.0) ast (2.4.2) - autoprefixer-rails (9.6.0) - execjs - awesome_print (1.8.0) + autoprefixer-rails (10.4.19.0) + execjs (~> 2) + awesome_print (1.9.2) aws-eventstream (1.3.0) - aws-partitions (1.968.0) - aws-record (2.5.0) - aws-sdk-dynamodb (~> 1.18) - aws-sdk-autoscaling (1.115.0) - aws-sdk-core (~> 3, >= 3.201.0) + aws-partitions (1.984.0) + aws-record (2.13.2) + aws-sdk-dynamodb (~> 1, >= 1.85.0) + aws-sdk-autoscaling (1.121.0) + aws-sdk-core (~> 3, >= 3.207.0) aws-sigv4 (~> 1.5) - aws-sdk-cloudwatch (1.44.0) - aws-sdk-core (~> 3, >= 3.99.0) - aws-sigv4 (~> 1.1) - aws-sdk-core (3.201.5) + aws-sdk-cloudwatch (1.103.0) + aws-sdk-core (~> 3, >= 3.207.0) + aws-sigv4 (~> 1.5) + aws-sdk-core (3.209.1) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.9) jmespath (~> 1, >= 1.6.1) - aws-sdk-dynamodb (1.53.0) - aws-sdk-core (~> 3, >= 3.99.0) - aws-sigv4 (~> 1.1) - aws-sdk-rails (3.6.0) + aws-sdk-dynamodb (1.125.0) + aws-sdk-core (~> 3, >= 3.207.0) + aws-sigv4 (~> 1.5) + aws-sdk-rails (3.13.0) aws-record (~> 2) - aws-sdk-ses (~> 1) - aws-sdk-sqs (~> 1) + aws-sdk-ses (~> 1, >= 1.50.0) + aws-sdk-sesv2 (~> 1, >= 1.34.0) + aws-sdk-sqs (~> 1, >= 1.56.0) aws-sessionstore-dynamodb (~> 2) - concurrent-ruby (~> 1) + concurrent-ruby (>= 1.3.1) railties (>= 5.2.0) - aws-sdk-rds (1.131.0) - aws-sdk-core (~> 3, >= 3.122.0) - aws-sigv4 (~> 1.1) - aws-sdk-ses (1.35.0) - aws-sdk-core (~> 3, >= 3.99.0) - aws-sigv4 (~> 1.1) - aws-sdk-sqs (1.33.0) - aws-sdk-core (~> 3, >= 3.99.0) - aws-sigv4 (~> 1.1) - aws-sessionstore-dynamodb (2.0.1) - aws-sdk-dynamodb (~> 1) - rack (~> 2) - aws-sigv4 (1.9.1) + aws-sdk-rds (1.252.0) + aws-sdk-core (~> 3, >= 3.207.0) + aws-sigv4 (~> 1.5) + aws-sdk-ses (1.75.0) + aws-sdk-core (~> 3, >= 3.207.0) + aws-sigv4 (~> 1.5) + aws-sdk-sesv2 (1.63.0) + aws-sdk-core (~> 3, >= 3.207.0) + aws-sigv4 (~> 1.5) + aws-sdk-sqs (1.86.0) + aws-sdk-core (~> 3, >= 3.207.0) + aws-sigv4 (~> 1.5) + aws-sessionstore-dynamodb (2.2.0) + aws-sdk-dynamodb (~> 1, >= 1.85.0) + rack (>= 2, < 4) + rack-session (>= 1, < 3) + aws-sigv4 (1.10.0) aws-eventstream (~> 1, >= 1.0.2) base64 (0.2.0) - bcrypt (3.1.18) + bcrypt (3.1.20) bigdecimal (3.1.8) bindata (2.5.0) bindex (0.8.1) - blazer (2.6.4) + blazer (2.6.5) activerecord (>= 5) chartkick (>= 3.2) railties (>= 5) safely_block (>= 0.1.1) - bootsnap (1.9.1) - msgpack (~> 1.0) + bootsnap (1.18.4) + msgpack (~> 1.2) bootstrap-sass (3.4.1) autoprefixer-rails (>= 5.2.1) sassc (>= 2.0.0) builder (3.3.0) byebug (11.1.3) - capybara (3.35.3) + capybara (3.40.0) addressable + matrix mini_mime (>= 0.1.3) - nokogiri (~> 1.8) + nokogiri (~> 1.11) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) @@ -153,17 +173,19 @@ GEM capybara-email (3.0.2) capybara (>= 2.4, < 4.0) mail - capybara-screenshot (1.0.19) + capybara-screenshot (1.0.26) capybara (>= 1.0, < 4) launchy - cgi (0.3.6) - chartkick (4.2.1) + cgi (0.4.1) + chartkick (5.0.7) + childprocess (5.1.0) + logger (~> 1.5) choice (0.2.0) chronic (0.10.2) chunky_png (1.4.0) codecov (0.6.0) simplecov (>= 0.15, < 0.22) - coderay (1.1.1) + coderay (1.1.3) coffee-rails (5.0.0) coffee-script (>= 2.2.0) railties (>= 5.2.0) @@ -183,89 +205,66 @@ GEM sass (>= 3.3.0, < 3.5) compass-import-once (1.0.5) sass (>= 3.2, < 3.5) - compass-rails (3.1.0) + compass-rails (2.0.1) compass (~> 1.0.0) - sass-rails (< 5.1) - sprockets (< 4.0) concurrent-ruby (1.3.4) - crack (0.4.5) + crack (1.0.0) + bigdecimal rexml crass (1.0.6) - css_parser (1.4.5) + css_parser (1.19.0) addressable - database_cleaner (1.8.5) + database_cleaner (2.0.2) + database_cleaner-active_record (>= 2, < 3) + database_cleaner-active_record (2.2.0) + activerecord (>= 5.a) + database_cleaner-core (~> 2.0.0) + database_cleaner-core (2.0.1) date (3.3.4) - db-query-matchers (0.6.0) + db-query-matchers (0.13.0) + activesupport (>= 4.0, < 7.3) + rspec (>= 3.0) declarative (0.0.20) declarative-option (0.1.0) - delayed_job (4.1.10) + delayed_job (4.1.12) activesupport (>= 3.0, < 8.0) - delayed_job_active_record (4.1.7) + delayed_job_active_record (4.1.10) activerecord (>= 3.0, < 8.0) delayed_job (>= 3.0, < 5) - delayed_job_heartbeat_plugin (0.4.0) + delayed_job_heartbeat_plugin (0.5.0) delayed_job (>= 4.1.0) delayed_job_active_record (>= 4.1.0) - delayed_job_worker_pool (0.3.0) + delayed_job_worker_pool (1.0.0) delayed_job (>= 3.0, < 4.2) - diff-lcs (1.4.4) + diff-lcs (1.5.1) diffy (3.4.2) - docile (1.4.0) + docile (1.4.1) doorkeeper (5.1.2) railties (>= 5) - dotenv (2.7.6) - dotenv-rails (2.7.6) - dotenv (= 2.7.6) + dotenv (2.8.1) + dotenv-rails (2.8.1) + dotenv (= 2.8.1) railties (>= 3.2) - dry-configurable (0.9.0) - concurrent-ruby (~> 1.0) - dry-core (~> 0.4, >= 0.4.7) - dry-container (0.7.2) - concurrent-ruby (~> 1.0) - dry-configurable (~> 0.1, >= 0.1.3) - dry-core (0.4.9) - concurrent-ruby (~> 1.0) - dry-equalizer (0.3.0) - dry-inflector (0.2.0) - dry-logic (0.4.2) - dry-container (~> 0.2, >= 0.2.6) - dry-core (~> 0.2) - dry-equalizer (~> 0.2) - dry-types (0.13.4) - concurrent-ruby (~> 1.0) - dry-container (~> 0.3) - dry-core (~> 0.4, >= 0.4.4) - dry-equalizer (~> 0.2) - dry-inflector (~> 0.1, >= 0.1.2) - dry-logic (~> 0.4, >= 0.4.2) - dry-validation (0.12.3) - concurrent-ruby (~> 1.0) - dry-configurable (~> 0.1, >= 0.1.3) - dry-core (~> 0.2, >= 0.2.1) - dry-equalizer (~> 0.2) - dry-logic (~> 0.4.2) - dry-types (~> 0.13.1) - em-websocket (0.5.1) + em-websocket (0.5.3) eventmachine (>= 0.12.9) - http_parser.rb (~> 0.6.0) - errbase (0.2.2) + http_parser.rb (~> 0) error_page_assets (0.4) erubi (1.13.0) - eventmachine (1.2.0.1) + eventmachine (1.2.7) exception_notification (4.5.0) actionmailer (>= 5.2, < 8) activesupport (>= 5.2, < 8) - execjs (2.8.1) - factory_bot (5.0.2) - activesupport (>= 4.2.0) - factory_bot_rails (5.0.2) - factory_bot (~> 5.0.2) - railties (>= 4.2.0) - faker (2.8.1) - i18n (>= 1.6, < 1.8) - fakeredis (0.6.0) - redis (~> 3.2) - faraday (1.10.3) + execjs (2.9.1) + factory_bot (6.5.0) + activesupport (>= 5.0.0) + factory_bot_rails (6.4.3) + factory_bot (~> 6.4) + railties (>= 5.0.0) + faker (3.4.2) + i18n (>= 1.8.11, < 2) + fakeredis (0.9.2) + redis (~> 4.8) + faraday (1.10.4) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -292,7 +291,7 @@ GEM faraday-patron (1.0.0) faraday-rack (1.0.0) faraday-retry (1.0.3) - faraday_middleware (1.2.0) + faraday_middleware (1.2.1) faraday (~> 1.0) ffi (1.17.0) ffi (1.17.0-x86_64-darwin) @@ -302,20 +301,21 @@ GEM jquery-rails rails (< 7) responders - font-awesome-rails (4.7.0.5) - railties (>= 3.2, < 6.1) - formatador (0.2.5) - get_process_mem (0.2.7) + font-awesome-rails (4.7.0.8) + railties (>= 3.2, < 8.0) + formatador (1.1.0) + get_process_mem (1.0.0) + bigdecimal (>= 2.0) ffi (~> 1.0) globalid (1.1.0) activesupport (>= 5.0) - guard (2.14.0) + guard (2.18.1) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) - lumberjack (~> 1.0) + lumberjack (>= 1.0.12, < 2.0) nenv (~> 0.1) notiffany (~> 0.0) - pry (>= 0.9.12) + pry (>= 0.13.0) shellany (~> 0.0) thor (>= 0.18.1) guard-compat (1.2.1) @@ -324,19 +324,19 @@ GEM guard (~> 2.8) guard-compat (~> 1.0) multi_json (~> 1.8) - guard-rspec (4.7.2) + guard-rspec (4.7.3) guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) - hashdiff (1.0.1) + hashdiff (1.1.1) hashie (5.0.0) highline (3.1.1) reline htmlentities (4.3.4) http_accept_language (2.1.1) - http_parser.rb (0.6.0) + http_parser.rb (0.8.0) httpclient (2.8.3) - i18n (1.7.1) + i18n (1.14.6) concurrent-ruby (~> 1.0) i18n-tasks (1.0.14) activesupport (>= 4.0.2) @@ -350,13 +350,15 @@ GEM terminal-table (>= 1.5.1) io-console (0.7.2) jaro_winkler (1.5.6) - jbuilder (2.9.1) - activesupport (>= 4.2.0) + jbuilder (2.13.0) + actionview (>= 5.0.0) + activesupport (>= 5.0.0) jmespath (1.6.2) - jobba (1.4.0) - redis (~> 3.2) + jobba (2.0.0) + oj + redis (>= 4.0) redis-namespace - jquery-rails (4.4.0) + jquery-rails (4.6.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -365,13 +367,14 @@ GEM aes_key_wrap bindata httpclient - jwt (2.8.2) + jwt (2.9.3) base64 keyword_search (1.5.0) - knockoutjs-rails (3.5.0) - railties (>= 3.1, < 6) - launchy (2.5.0) - addressable (~> 2.7) + knockoutjs-rails (3.5.1.1) + railties (>= 3.1) + launchy (3.0.1) + addressable (~> 2.8) + childprocess (~> 5.0) lev (10.1.0) actionpack (>= 4.2) active_attr @@ -387,7 +390,8 @@ GEM listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - lograge (0.11.2) + logger (1.6.1) + lograge (0.14.0) actionpack (>= 4) activesupport (>= 4) railties (>= 4) @@ -395,7 +399,7 @@ GEM loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) - lumberjack (1.0.10) + lumberjack (1.2.10) mail (2.8.1) mini_mime (>= 0.1.1) net-imap @@ -403,21 +407,22 @@ GEM net-smtp marcel (1.0.4) maruku (0.7.3) - meta_request (0.7.2) + matrix (0.4.2) + meta_request (0.8.3) rack-contrib (>= 1.1, < 3) - railties (>= 3.0.0, < 7) - method_source (0.8.2) + railties (>= 3.0.0, < 8) + method_source (1.1.0) mini_mime (1.1.5) mini_portile2 (2.8.7) mini_racer (0.12.0) libv8-node (~> 21.7.2.0) minitest (5.25.1) - msgpack (1.5.2) + msgpack (1.7.3) multi_json (1.15.0) multi_xml (0.6.0) multipart-post (2.4.1) nenv (0.3.0) - net-imap (0.4.15) + net-imap (0.4.16) date net-protocol net-pop (0.1.2) @@ -434,16 +439,21 @@ GEM racc (~> 1.4) nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) - notiffany (0.1.0) + notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) - oauth (0.5.6) - oauth2 (1.4.4) - faraday (>= 0.8, < 2.0) + oauth (1.1.0) + oauth-tty (~> 1.0, >= 1.0.1) + snaky_hash (~> 2.0) + version_gem (~> 1.1) + oauth-tty (1.0.5) + version_gem (~> 1.1, >= 1.1.1) + oauth2 (1.4.11) + faraday (>= 0.17.3, < 3.0) jwt (>= 1.0, < 3.0) multi_json (~> 1.3) multi_xml (~> 0.5) - rack (>= 1.2, < 3) + rack (>= 1.2, < 4) oj (3.16.6) bigdecimal (>= 3.0) ostruct (>= 0.2) @@ -451,21 +461,24 @@ GEM omniauth (1.9.2) hashie (>= 3.4.6) rack (>= 1.6.2, < 3) - omniauth-facebook (6.0.0) - omniauth-oauth2 (~> 1.2) - omniauth-google-oauth2 (0.8.0) + omniauth-facebook (10.0.0) + bigdecimal + omniauth-oauth2 (>= 1.2, < 3) + omniauth-google-oauth2 (0.8.2) jwt (>= 2.0) - omniauth (>= 1.1.1) + oauth2 (~> 1.1) + omniauth (~> 1.1) omniauth-oauth2 (>= 1.6) omniauth-identity (3.0.9) bcrypt omniauth - omniauth-oauth (1.1.0) + omniauth-oauth (1.2.1) oauth - omniauth (~> 1.0) - omniauth-oauth2 (1.6.0) - oauth2 (~> 1.1) - omniauth (~> 1.9) + omniauth (>= 1.0, < 3) + rack (>= 1.6.2, < 4) + omniauth-oauth2 (1.7.3) + oauth2 (>= 1.4, < 3) + omniauth (>= 1.9, < 3) omniauth-twitter (1.4.0) omniauth-oauth (~> 1.1) rack @@ -501,109 +514,108 @@ GEM rails (>= 5.0, < 8.0) request_store ostruct (0.6.0) - p3p (1.2.0) - rack - parallel (1.19.2) - parallel_tests (3.1.0) + p3p (2.0.0) + rack (>= 1.6.2) + parallel (1.26.3) + parallel_tests (4.7.2) parallel parser (3.3.5.0) ast (~> 2.4.1) racc pg (1.5.8) - premailer (1.8.7) - css_parser (>= 1.4.5) + premailer (1.27.0) + addressable + css_parser (>= 1.19.0) htmlentities (>= 4.0.0) - premailer-rails (1.9.4) - actionmailer (>= 3, < 6) + premailer-rails (1.12.0) + actionmailer (>= 3) + net-smtp premailer (~> 1.7, >= 1.7.9) - pry (0.10.4) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - public_suffix (5.1.1) - puma (5.6.8) + pry (0.14.2) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (6.0.1) + puma (5.6.9) nio4r (~> 2.0) - puma_worker_killer (0.3.1) - get_process_mem (~> 0.2) + puma_worker_killer (1.0.0) + bigdecimal (>= 2.0) + get_process_mem (>= 0.2) puma (>= 2.7) racc (1.8.1) rack (2.2.9) rack-contrib (2.5.0) rack (< 4) - rack-cors (1.1.1) + rack-cors (2.0.2) rack (>= 2.0.0) + rack-session (1.0.2) + rack (< 3) rack-test (2.1.0) rack (>= 1.3) - rails (5.2.8.1) - actioncable (= 5.2.8.1) - actionmailer (= 5.2.8.1) - actionpack (= 5.2.8.1) - actionview (= 5.2.8.1) - activejob (= 5.2.8.1) - activemodel (= 5.2.8.1) - activerecord (= 5.2.8.1) - activestorage (= 5.2.8.1) - activesupport (= 5.2.8.1) + rails (6.0.6.1) + actioncable (= 6.0.6.1) + actionmailbox (= 6.0.6.1) + actionmailer (= 6.0.6.1) + actionpack (= 6.0.6.1) + actiontext (= 6.0.6.1) + actionview (= 6.0.6.1) + activejob (= 6.0.6.1) + activemodel (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) bundler (>= 1.3.0) - railties (= 5.2.8.1) + railties (= 6.0.6.1) sprockets-rails (>= 2.0.0) - rails-controller-testing (1.0.4) - actionpack (>= 5.0.1.x) - actionview (>= 5.0.1.x) - activesupport (>= 5.0.1.x) + rails-controller-testing (1.0.5) + actionpack (>= 5.0.1.rc1) + actionview (>= 5.0.1.rc1) + activesupport (>= 5.0.1.rc1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-erd (1.5.2) - activerecord (>= 3.2) - activesupport (>= 3.2) + rails-erd (1.7.2) + activerecord (>= 4.2) + activesupport (>= 4.2) choice (~> 0.2.0) ruby-graphviz (~> 1.2) rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - rails-i18n (5.1.3) + rails-i18n (7.0.9) i18n (>= 0.7, < 2) - railties (>= 5.0, < 6) - rails-settings-cached (0.7.2) - rails (>= 4.2.0) - rails-settings-ui (1.3.5) - dry-types - dry-validation (< 1.0) - i18n - rails (>= 3.0) - railties (5.2.8.1) - actionpack (= 5.2.8.1) - activesupport (= 5.2.8.1) + railties (>= 6.0.0, < 8) + railties (6.0.6.1) + actionpack (= 6.0.6.1) + activesupport (= 6.0.6.1) method_source rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) + thor (>= 0.20.3, < 2.0) rainbow (3.1.1) rake (13.2.1) rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - redis (3.3.5) - redis-actionpack (5.0.2) - actionpack (>= 4.0, < 6) - redis-rack (>= 1, < 3) + redis (4.8.1) + redis-actionpack (5.4.0) + actionpack (>= 5, < 8) + redis-rack (>= 2.1.0, < 4) redis-store (>= 1.1.0, < 2) - redis-activesupport (5.0.4) - activesupport (>= 3, < 6) + redis-activesupport (5.3.0) + activesupport (>= 3, < 8) redis-store (>= 1.3, < 2) - redis-namespace (1.5.2) - redis (~> 3.0, >= 3.0.4) - redis-rack (2.0.4) - rack (>= 1.5, < 3) + redis-namespace (1.11.0) + redis (>= 4) + redis-rack (3.0.0) + rack-session (>= 0.2.0) redis-store (>= 1.2, < 2) redis-rails (5.0.2) redis-actionpack (>= 5.0, < 6) redis-activesupport (>= 5.0, < 6) redis-store (>= 1.2, < 2) - redis-store (1.4.1) - redis (>= 2.2, < 5) - regexp_parser (2.1.0) + redis-store (1.11.0) + redis (>= 4, < 6) + regexp_parser (2.9.2) reline (0.5.10) io-console (~> 0.5) render_anywhere (0.0.12) @@ -617,15 +629,14 @@ GEM responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) - restforce (6.2.4) - faraday (>= 1.1.0, < 2.8.0) + restforce (7.5.0) + faraday (>= 1.1.0, < 2.12.0) faraday-follow_redirects (<= 0.3.0, < 1.0.0) faraday-multipart (>= 1.0.0, < 2.0.0) faraday-net_http (< 4.0.0) hashie (>= 1.2.0, < 6.0) jwt (>= 1.5.6) - rexml (3.3.6) - strscan + rexml (3.3.8) roar (1.1.1) representable (~> 3.0) roar-rails (1.1.0) @@ -635,29 +646,29 @@ GEM roar (~> 1.1.0) test_xml (>= 0.1.6) uber (< 0.2.0) - rspec (3.10.0) - rspec-core (~> 3.10.0) - rspec-expectations (~> 3.10.0) - rspec-mocks (~> 3.10.0) - rspec-core (3.10.1) - rspec-support (~> 3.10.0) - rspec-expectations (3.10.1) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.1) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) + rspec-support (~> 3.13.0) rspec-instafail (1.0.0) rspec - rspec-mocks (3.10.2) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-rails (4.0.2) - actionpack (>= 4.2) - activesupport (>= 4.2) - railties (>= 4.2) + rspec-support (~> 3.13.0) + rspec-rails (5.1.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + railties (>= 5.2) rspec-core (~> 3.10) rspec-expectations (~> 3.10) rspec-mocks (~> 3.10) rspec-support (~> 3.10) - rspec-support (3.10.2) + rspec-support (3.13.1) rubocop (0.76.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) @@ -665,39 +676,39 @@ GEM rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 1.7) - rubocop-rspec (1.36.0) + rubocop-rspec (1.41.0) rubocop (>= 0.68.1) - ruby-graphviz (1.2.3) - ruby-progressbar (1.10.1) + ruby-graphviz (1.2.5) + rexml + ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) rubyzip (2.3.2) - safely_block (0.3.0) - errbase (>= 0.1.1) + safely_block (0.4.1) sass (3.4.25) - sass-rails (5.0.8) - railties (>= 5.2.0) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) - sassc (2.0.1) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.4.0) ffi (~> 1.9) - rake + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt sd_notify (0.1.1) - selenium-webdriver (4.9.0) + selenium-webdriver (4.10.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) - sentry-delayed_job (4.4.0) - sentry-ruby-core (~> 4.4.0.pre.beta) - sentry-rails (5.16.1) + sentry-delayed_job (5.20.1) + delayed_job (>= 4.0) + sentry-ruby (~> 5.20.1) + sentry-rails (5.20.1) railties (>= 5.0) - sentry-ruby (~> 5.16.1) - sentry-ruby (5.16.1) + sentry-ruby (~> 5.20.1) + sentry-ruby (5.20.1) + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) - sentry-ruby-core (4.4.2) - concurrent-ruby - faraday shellany (0.0.1) shoulda-matchers (3.1.3) activesupport (>= 4.0.0) @@ -705,22 +716,22 @@ GEM docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) + simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) - slop (3.6.0) - smarter_csv (1.1.0) - spring (1.7.2) + smarter_csv (1.12.1) + snaky_hash (2.0.1) + hashie + version_gem (~> 1.1, >= 1.1.1) + spring (4.2.1) spring-commands-rspec (1.0.4) spring (>= 0.9.1) - sprockets (3.7.3) - base64 + sprockets (4.2.1) concurrent-ruby (~> 1.0) - rack (> 1, < 3) + rack (>= 2.2.4, < 4) sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - strscan (3.1.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) test_xml (0.1.8) @@ -728,8 +739,8 @@ GEM nokogiri (>= 1.3.2) thor (1.3.2) thread_safe (0.3.6) - tilt (2.0.10) - timecop (0.8.1) + tilt (2.4.0) + timecop (0.9.10) timeout (0.4.1) transaction_isolation (1.0.5) activerecord (>= 3.0.11) @@ -739,10 +750,12 @@ GEM tzinfo (1.2.11) thread_safe (~> 0.1) uber (0.1.0) - uglifier (4.2.0) + uglifier (4.2.1) execjs (>= 0.3.0, < 3) unicode-display_width (1.6.1) - vcr (3.0.3) + vcr (6.3.1) + base64 + version_gem (1.1.4) web-console (3.7.0) actionview (>= 5.0) activemodel (>= 5.0) @@ -752,21 +765,22 @@ GEM nokogiri (~> 1.6) rubyzip (>= 1.3.0) selenium-webdriver (~> 4.0, < 4.11) - webmock (3.11.2) - addressable (>= 2.3.6) + webmock (3.24.0) + addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - websocket (1.2.9) + websocket (1.2.11) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - whenever (0.9.7) + whenever (1.0.0) chronic (>= 0.6.3) whenever-test (1.0.1) whenever - will_paginate (3.3.0) + will_paginate (4.0.1) xpath (3.2.0) nokogiri (~> 1.8) + zeitwerk (2.6.18) PLATFORMS ruby @@ -794,7 +808,7 @@ DEPENDENCIES chronic codecov coffee-rails (= 5.0.0) - compass-rails (~> 3.1.0) + compass-rails database_cleaner db-query-matchers delayed_job_active_record @@ -802,7 +816,6 @@ DEPENDENCIES delayed_job_worker_pool doorkeeper (~> 5.1.0) dotenv-rails - dry-validation (= 0.12.3) error_page_assets factory_bot_rails faker @@ -850,12 +863,10 @@ DEPENDENCIES puma (~> 5.6.0) puma_worker_killer rack-cors - rails (~> 5.2) + rails (= 6.0.6.1) rails-controller-testing rails-erd - rails-i18n (~> 5) - rails-settings-cached (= 0.7.2) - rails-settings-ui + rails-i18n redis-rails render_anywhere representable (~> 3.0.0) @@ -863,7 +874,7 @@ DEPENDENCIES rspec-rails rubocop (~> 0.76.0) rubocop-rspec - sass-rails (~> 5.0) + sass-rails sd_notify selenium-webdriver sentry-delayed_job diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 0000000000..7d2471a639 --- /dev/null +++ b/app/assets/config/manifest.js @@ -0,0 +1,17 @@ +//= link_tree ../images +// +//= link admin.js +//= link application.js +//= link faculty_access.js +//= link newflow.js +//= link signin.js +//= link signup.js +//= link profile.js +//= link newflow/educator_signup_email_validations.js +//= link remote-access.js +// +//= link admin.css +//= link application.css +//= link application_body_api_docs.css +//= link newflow.css +//= link syntax_highlight.css diff --git a/bin/setup b/bin/setup index 94fd4d7977..0e39e8cb13 100755 --- a/bin/setup +++ b/bin/setup @@ -1,6 +1,5 @@ #!/usr/bin/env ruby require 'fileutils' -include FileUtils # path to your application root. APP_ROOT = File.expand_path('..', __dir__) @@ -9,24 +8,22 @@ 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 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. puts '== Installing dependencies ==' system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') - # Install JavaScript dependencies if using Yarn - # system('bin/yarn') - # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') - # cp 'config/database.yml.sample', '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' diff --git a/bin/update b/bin/update old mode 100644 new mode 100755 diff --git a/config/application.rb b/config/application.rb index 5ba078b4f9..e7c36f3f08 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,4 +1,5 @@ require_relative 'boot' + require 'rails/all' # Require the gems listed in Gemfile, including any gems @@ -11,55 +12,10 @@ class Application < Rails::Application config.load_defaults 5.2 # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers + # Application configuration can go into files in config/initializers # -- all .rb files in that directory are automatically loaded after loading # the framework and any gems in your application. - # 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. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - config.i18n.default_locale = :en - config.i18n.available_locales = %w(en pl) - - config.accounts = ActiveSupport::OrderedOptions.new - # configure how long a login token is valid for - config.accounts.default_login_token_expiration_period = 2.days - # configure how long a password is valid for - config.accounts.default_password_expiration_period = nil - - # Suppress a warning - config.i18n.enforce_available_locales = true - - # Use the ExceptionsController to rescue routing/bad request exceptions - # https://coderwall.com/p/w3ghqq/rails-3-2-error-handling-with-exceptions_app - config.exceptions_app = ->(env) { ExceptionsController.action(:rescue_from).call(env) } - - # Use delayed_job for background jobs - config.active_job.queue_adapter = :delayed_job - - redis_secrets = secrets[:redis] - - # Generate the Redis URL from the its components if unset - redis_secrets[:url] ||= "redis#{'s' unless redis_secrets[:password].blank?}://#{ - ":#{redis_secrets[:password]}@" unless redis_secrets[:password].blank? }#{ - redis_secrets[:host]}#{":#{redis_secrets[:port]}" unless redis_secrets[:port].blank?}/#{ - "/#{redis_secrets[:db]}" unless redis_secrets[:db].blank?}" - - config.cache_store = :redis_store, { - url: redis_secrets[:url], - namespace: redis_secrets[:namespaces][:cache], - expires_in: 90.minutes, - compress: true, - } - - def is_real_production? - [ 'production', 'prodtutor' ].include? secrets.environment_name - end - # https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#new-framework-defaults config.active_record.belongs_to_required_by_default = false config.autoload_paths += %W(#{config.root}/lib) diff --git a/config/boot.rb b/config/boot.rb index 281a7f1440..38e6c68dfc 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,7 +1,6 @@ -# Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 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. require_relative 'dev_url_options' diff --git a/config/cable.yml b/config/cable.yml index c4df575a0b..2ae8db81fd 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -2,7 +2,7 @@ development: adapter: async test: - adapter: async + adapter: test production: adapter: redis diff --git a/config/environment.rb b/config/environment.rb index d1b115e8b8..2919ba356f 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,4 +1,4 @@ -# Load the Rails application +# Load the Rails application. require_relative 'application' require 'env_utilities' @@ -25,12 +25,5 @@ require 'date_time' require 'educator_signup_flow_decorator' -SITE_NAME = 'OpenStax Accounts' -PAGE_TITLE_SUFFIX = SITE_NAME -TEAM_NAME = 'OpenStax' # used when talking about our team -COPYRIGHT_HOLDER = 'Rice University' - -UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/ - -# Initialize the Rails application +# Initialize the Rails application. Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 3591d23265..9ad9ef617e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -16,6 +16,7 @@ # 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 = { @@ -27,7 +28,7 @@ config.cache_store = :null_store end - # 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 # Don't care if the mailer can't send. @@ -54,7 +55,7 @@ # Suppress logger output for asset requests. config.assets.quiet = true - # Raises error for missing translations + # Raises error for missing translations. config.action_view.raise_on_missing_translations = true # Use an evented file watcher to asynchronously detect changes in source code, diff --git a/config/environments/production.rb b/config/environments/production.rb index af256dede8..7de4b7fcda 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,50 +1,55 @@ secrets = Rails.application.secrets 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. - # Forgery Protection with Origin Check - # -- In Rails 5 you can now configure your application to check if the HTTP Origin header - # should be checked against the site's origin as an additional CSRF defense. - # https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#forgery-protection-with-origin-check - # config.action_controller.forgery_protection_origin_check = false - - # Code is not reloaded between requests + # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both thread web servers + # your application in memory, allowing both threaded web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true - # Full error reports are disabled and caching is turned on + # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true - # Enable Rack::Cache to put a simple HTTP cache in front of your application - # Add `rack-cache` to your Gemfile before enabling this. - # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. - # config.action_dispatch.rack_cache = true + # 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 Rails's static asset server (Apache or nginx will already do this) - config.serve_static_files = false + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? - # Compress JavaScripts and CSS + # Compress JS config.assets.js_compressor = Uglifier.new(harmony: true) + + # Compress CSS using a preprocessor. # config.assets.css_compressor = :sass - # Don't fallback to assets pipeline if a precompiled asset is missed + # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + # Generate digests for assets URLs config.assets.digest = true - # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + # 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-Accel-Redirect' # for NGINX - # 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-Accel-Redirect' # for nginx + # Store uploaded files on the local file system (see config/storage.yml for options). + config.active_storage.service = :local + + # Mount Action Cable outside main process or domain. + # config.action_cable.mount_path = nil + # config.action_cable.url = 'wss://example.com/cable' + # 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. config.force_ssl = true @@ -52,17 +57,17 @@ # Set to :debug to see everything in the log. config.log_level = :info - # Prepend all log lines with the following tags - # config.log_tags = [ :subdomain, :uuid ] - - # Use a different logger for distributed setups - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + # Prepend all log lines with the following tags. + 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 - # Enable serving of images, stylesheets, and JavaScripts from an asset server - # config.action_controller.asset_host = "http://assets.example.com" + # Use a real queuing backend for Active Job (and separate queues per environment). + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "accounts_production" + + config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. @@ -72,22 +77,23 @@ config.action_mailer.default_url_options = { protocol: 'https', host: secrets[:email_host] } # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found) + # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true - # Send deprecation notices to registered listeners + # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify - # Disable automatic flushing of the log to improve performance. - # config.autoflush_log = false - # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new - # Log to STDOUT and let systemd/journald handle the logs - logger = ActiveSupport::Logger.new(STDOUT) - logger.formatter = config.log_formatter - config.logger = ActiveSupport::TaggedLogging.new(logger) + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end # Lograge configuration (one-line logs in production) config.lograge.enabled = true @@ -102,4 +108,25 @@ # Do not dump schema after migrations. 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 diff --git a/config/environments/test.rb b/config/environments/test.rb index 8e2059c788..af889a05f8 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,41 +1,51 @@ +# 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 + # 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 = false + config.action_view.cache_template_loading = 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 = ENV['CI'] == 'true' - # Configure static asset server for tests with Cache-Control for performance - config.serve_static_files = true - config.static_cache_control = 'public, max-age=3600' + # 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.to_i}" + } - # Show full error reports and disable caching + # 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 + # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false - # Disable request forgery protection in test environment + # 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. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test config.action_mailer.default_url_options = DEV_URL_OPTIONS - # Print deprecation notices to the stderr + # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr - # Raises error for missing translations + # Raises error for missing translations. # config.action_view.raise_on_missing_translations = true config.active_support.test_order = :random diff --git a/config/initializers/04-debugger.rb b/config/initializers/1-debugger.rb similarity index 84% rename from config/initializers/04-debugger.rb rename to config/initializers/1-debugger.rb index 0b5f26dda7..2fb7240816 100644 --- a/config/initializers/04-debugger.rb +++ b/config/initializers/1-debugger.rb @@ -5,7 +5,7 @@ require 'byebug' else # Debug in VS Code - require 'ruby-debug-ide' - require 'debase' + # require 'ruby-debug-ide' + # require 'debase' end end diff --git a/config/initializers/constants.rb b/config/initializers/2-constants.rb similarity index 89% rename from config/initializers/constants.rb rename to config/initializers/2-constants.rb index 057a7fa3cc..0a8f7d454e 100644 --- a/config/initializers/constants.rb +++ b/config/initializers/2-constants.rb @@ -1,3 +1,10 @@ +SITE_NAME = 'OpenStax Accounts' +PAGE_TITLE_SUFFIX = SITE_NAME +TEAM_NAME = 'OpenStax' # used when talking about our team +COPYRIGHT_HOLDER = 'Rice University' + +UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/ + US_STATES = [ "AK", "Alaska", "AL", @@ -107,4 +114,4 @@ "WV", "West Virginia", "WY", - "Wyoming"].freeze \ No newline at end of file + "Wyoming"].freeze diff --git a/config/initializers/05-settings.rb b/config/initializers/3-settings.rb similarity index 84% rename from config/initializers/05-settings.rb rename to config/initializers/3-settings.rb index 33d14ec097..e30602473c 100644 --- a/config/initializers/05-settings.rb +++ b/config/initializers/3-settings.rb @@ -1,4 +1,4 @@ # We need to require settings here so we guarantee they are available # before other initialization code. -require 'settings' +#require 'settings' diff --git a/config/initializers/4-accounts.rb b/config/initializers/4-accounts.rb new file mode 100644 index 0000000000..15b99211a3 --- /dev/null +++ b/config/initializers/4-accounts.rb @@ -0,0 +1,6 @@ +accounts = ActiveSupport::OrderedOptions.new +# configure how long a login token is valid for +accounts.default_login_token_expiration_period = 2.days +# configure how long a password is valid for +accounts.default_password_expiration_period = nil +Rails.application.config.accounts = accounts diff --git a/config/initializers/active_job.rb b/config/initializers/active_job.rb new file mode 100644 index 0000000000..6627277b2d --- /dev/null +++ b/config/initializers/active_job.rb @@ -0,0 +1,2 @@ +# Use delayed_job for background jobs +Rails.application.config.active_job.queue_adapter = :delayed_job diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb new file mode 100644 index 0000000000..89d2efab2b --- /dev/null +++ b/config/initializers/application_controller_renderer.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# ActiveSupport::Reloader.to_prepare do +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) +# end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 2ce94c93bb..fe48fc34ee 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -3,24 +3,10 @@ # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' +# Add additional assets to the asset load path. +# Rails.application.config.assets.paths << Emoji.images_path + # Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. -Rails.application.config.assets.precompile += %w( - admin.css - admin.js - profile.js - signup.js - signin.js - faculty_access.js - remote-access.js - bootstrap-editable/loading.gif - bootstrap-editable/clear.png - application_body_api_docs.css - intTelInput.css - libphonenumber/utils.js - syntax_highlight.css - newflow.css - newflow_colors.css - newflow.js - newflow/educator_signup_email_validations.js -) +# application.js, application.css, and all non-JS/CSS in the app/assets +# folder are already added. +# Rails.application.config.assets.precompile += %w( admin.js admin.css ) diff --git a/config/initializers/cache_store.rb b/config/initializers/cache_store.rb new file mode 100644 index 0000000000..bfc66b4b11 --- /dev/null +++ b/config/initializers/cache_store.rb @@ -0,0 +1,14 @@ +redis_secrets = Rails.application.secrets[:redis] + +# Generate the Redis URL from the its components if unset +redis_secrets[:url] ||= "redis#{'s' unless redis_secrets[:password].blank?}://#{ + ":#{redis_secrets[:password]}@" unless redis_secrets[:password].blank? }#{ + redis_secrets[:host]}#{":#{redis_secrets[:port]}" unless redis_secrets[:port].blank?}/#{ + "/#{redis_secrets[:db]}" unless redis_secrets[:db].blank?}" + +Rails.application.config.cache_store = :redis_store, { + url: redis_secrets[:url], + namespace: redis_secrets[:namespaces][:cache], + expires_in: 90.minutes, + compress: true, +} diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb new file mode 100644 index 0000000000..41c43016f1 --- /dev/null +++ b/config/initializers/content_security_policy.rb @@ -0,0 +1,28 @@ +# Be sure to restart your server when you modify this file. + +# Define an application-wide content security policy +# For further information see the following documentation +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy + +# 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 diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index 1e34ce4f60..741169b370 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -6,11 +6,11 @@ # Read more: https://github.com/cyu/rack-cors Rails.application.config.middleware.insert_before 0, Rack::Cors do - allow do - origins /(.*\.|)localhost\:?.*/, /(.*\.|)127.0.0.1\:?.*/, /(.*\.|)openstax\.org/, 'www.example.com' - resource '*', - headers: :any, - methods: %i[get post put patch delete options head], - credentials: true - end + allow do + origins /(.*\.|)localhost\:?.*/, /(.*\.|)127.0.0.1\:?.*/, /(.*\.|)openstax\.org/, 'www.example.com' + resource '*', + headers: :any, + methods: [:get, :post, :put, :patch, :delete, :options, :head], + credentials: true + end end diff --git a/config/initializers/exceptions.rb b/config/initializers/exceptions.rb new file mode 100644 index 0000000000..939ae0f9ef --- /dev/null +++ b/config/initializers/exceptions.rb @@ -0,0 +1,5 @@ +# Use the ExceptionsController to rescue routing/bad request exceptions +# https://coderwall.com/p/w3ghqq/rails-3-2-error-handling-with-exceptions_app +Rails.application.config.exceptions_app = ->(env) { + ExceptionsController.action(:rescue_from).call(env) +} diff --git a/config/initializers/i18n.rb b/config/initializers/i18n.rb new file mode 100644 index 0000000000..2999cb2489 --- /dev/null +++ b/config/initializers/i18n.rb @@ -0,0 +1,3 @@ +i18n = Rails.application.config.i18n +i18n.available_locales = %w(en pl) +i18n.enforce_available_locales = true diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 9262c3379f..ac033bf9dc 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -9,7 +9,7 @@ # 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' diff --git a/config/initializers/is_real_production.rb b/config/initializers/is_real_production.rb new file mode 100644 index 0000000000..03918de3be --- /dev/null +++ b/config/initializers/is_real_production.rb @@ -0,0 +1,3 @@ +def is_real_production? + [ 'production', 'prodtutor' ].include? secrets.environment_name +end diff --git a/config/initializers/new_framework_defaults_6_0.rb b/config/initializers/new_framework_defaults_6_0.rb new file mode 100644 index 0000000000..92240ef5f5 --- /dev/null +++ b/config/initializers/new_framework_defaults_6_0.rb @@ -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 diff --git a/config/initializers/openstax_utilities.rb b/config/initializers/openstax_utilities.rb index 861d70dc3d..a1ae8739e2 100644 --- a/config/initializers/openstax_utilities.rb +++ b/config/initializers/openstax_utilities.rb @@ -9,7 +9,7 @@ next end - next if !Rails.application.is_real_production? || current_user.is_administrator? + next if !is_real_production? || current_user.is_administrator? raise SecurityTransgression end diff --git a/config/initializers/rails_settings_ui.rb b/config/initializers/rails_settings_ui.rb_ similarity index 100% rename from config/initializers/rails_settings_ui.rb rename to config/initializers/rails_settings_ui.rb_ diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index c3c181bdc1..bbfc3961bf 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -1,5 +1,5 @@ # Be sure to restart your server when you modify this file. -# + # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. @@ -10,5 +10,5 @@ # To enable root element in JSON for ActiveRecord objects. # ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true +# self.include_root_in_json = true # end diff --git a/config/locales/en.yml b/config/locales/en.yml index 785665e878..8d3afb3cda 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,3 +1,34 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# 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: educator_profile_form: complete_page_header: Complete your profile diff --git a/config/puma.rb b/config/puma.rb index 9c3dae996b..b87da1ffcb 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -48,24 +48,23 @@ # 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. # -max_threads = ENV.fetch('RAILS_MAX_THREADS', 5).to_i -threads ENV.fetch('RAILS_MIN_THREADS', max_threads).to_i, max_threads +max_threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 } +min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count } +threads min_threads_count, max_threads_count if ENV['SOCKET'] # Specifies the `socket` to which Puma will bind to receive requests. bind ENV['SOCKET'] else # Specifies the `port` that Puma will listen on to receive requests; default is DEV_PORT (2999). - port ENV.fetch('PORT', DEV_PORT) + port ENV.fetch('PORT') { DEV_PORT } end # 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/puma.pid') +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 @@ -83,7 +82,6 @@ preload_app! if ActiveModel::Type::Boolean.new.cast(ENV.fetch('PRELOAD_APP', false)) # Allow puma to be restarted by `rails restart` command. -# plugin :tmp_restart # Call GC.start and GC.compact before forking to try to reduce worker memory usage diff --git a/config/routes.rb b/config/routes.rb index 8cabcb5004..bbf8216f0f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,6 @@ # rubocop:disable Metrics/BlockLength Rails.application.routes.draw do - # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html + # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html root to: 'static_pages#home' direct :salesforce_knowledge_base do @@ -311,7 +311,7 @@ mount Blazer::Engine, at: "blazer", as: 'blazer_admin' - mount RailsSettingsUi::Engine, at: 'settings' + #mount RailsSettingsUi::Engine, at: 'settings' end namespace 'dev' do diff --git a/config/spring.rb b/config/spring.rb index 9fa7863f99..db5bf1307a 100644 --- a/config/spring.rb +++ b/config/spring.rb @@ -1,6 +1,6 @@ -%w[ - .ruby-version - .rbenv-vars - tmp/restart.txt - tmp/caching-dev.txt -].each { |path| Spring.watch(path) } +Spring.watch( + ".ruby-version", + ".rbenv-vars", + "tmp/restart.txt", + "tmp/caching-dev.txt" +) diff --git a/db/migrate/20241004201505_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb b/db/migrate/20241004201505_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb new file mode 100644 index 0000000000..ff5d72c7ea --- /dev/null +++ b/db/migrate/20241004201505_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb @@ -0,0 +1,10 @@ +# This migration comes from active_storage (originally 20180723000244) +class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0] + def up + return if foreign_key_exists?(:active_storage_attachments, column: :blob_id) + + if table_exists?(:active_storage_blobs) + add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 25d004d8e7..479b5ccd9e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2,15 +2,15 @@ # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). +# This file is the source Rails uses to define your schema when running `rails +# db:schema:load`. When creating a new database, `rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2024_08_08_171751) do +ActiveRecord::Schema.define(version: 2024_10_04_201505) do # These are extensions that must be enabled in order to support this database enable_extension "citext" diff --git a/lib/settings.rb b/lib/settings.rb_ similarity index 100% rename from lib/settings.rb rename to lib/settings.rb_