From 322c9bc85d3366a63b65f23d455844f078a4432d Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Sat, 22 Feb 2025 17:08:50 +0100 Subject: [PATCH 01/32] Upgrade to Ruby 3.2.7 --- Gemfile | 2 +- docker/development/Dockerfile | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index e324dfe1b..030b85307 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" # We only pin versions to specific Git commits when they are "problem childs" # and we want to review each commit before updating to the latest version. -ruby "3.1.4" +ruby "3.2.7" gem "active_model_serializers", "~> 0.10" gem "activerecord-import", "~>1.7" diff --git a/docker/development/Dockerfile b/docker/development/Dockerfile index 681e5826f..c5c2a66f2 100644 --- a/docker/development/Dockerfile +++ b/docker/development/Dockerfile @@ -11,13 +11,13 @@ RUN cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" . # Now build the actual MaMpf application # https://hub.docker.com/_/ruby/ -FROM ruby:3.1.4-bullseye +FROM ruby:3.2.7-bullseye EXPOSE 3000 EXPOSE 9394 # use "--login" option, so that .bashrc is sourced in new shells -SHELL ["/bin/bash", "--login", "-c"] +SHELL ["/bin/bash", "--login", "-c"] # Install Node.js # https://github.com/nodesource/distributions/issues/1583#issuecomment-1597489401 @@ -74,7 +74,7 @@ RUN if [ "$IN_CI_CD" = "true" ]; then \ echo "Running yarn install"; \ yarn install --production --frozen-lockfile; \ fi - + # Precompile assets in CI/CD # (See the production Dockerfile for an explanation of the dummy env file) COPY . /usr/src/app/ From 34689b012539ea8cfcc4ca8a4c1b313d894f8ad0 Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Sat, 22 Feb 2025 17:38:59 +0100 Subject: [PATCH 02/32] Update Gemfile.lock --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5cc9a8130..6f989fcd2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -743,7 +743,7 @@ DEPENDENCIES webpacker (~> 5.4) RUBY VERSION - ruby 3.1.4p223 + ruby 3.2.7p253 BUNDLED WITH 2.6.3 From a2b9c85b28bcec8748e18b2fcec9aaa5b58ef06b Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Sat, 22 Feb 2025 18:16:43 +0100 Subject: [PATCH 03/32] Upgrade to Ruby 3.3.7 --- Gemfile | 2 +- Gemfile.lock | 2 +- docker/development/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 030b85307..9862fdbb6 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" # We only pin versions to specific Git commits when they are "problem childs" # and we want to review each commit before updating to the latest version. -ruby "3.2.7" +ruby "3.3.7" gem "active_model_serializers", "~> 0.10" gem "activerecord-import", "~>1.7" diff --git a/Gemfile.lock b/Gemfile.lock index 6f989fcd2..7f8dbd831 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -743,7 +743,7 @@ DEPENDENCIES webpacker (~> 5.4) RUBY VERSION - ruby 3.2.7p253 + ruby 3.3.7p123 BUNDLED WITH 2.6.3 diff --git a/docker/development/Dockerfile b/docker/development/Dockerfile index c5c2a66f2..3e9fd643c 100644 --- a/docker/development/Dockerfile +++ b/docker/development/Dockerfile @@ -11,7 +11,7 @@ RUN cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" . # Now build the actual MaMpf application # https://hub.docker.com/_/ruby/ -FROM ruby:3.2.7-bullseye +FROM ruby:3.3.7-bullseye EXPOSE 3000 EXPOSE 9394 From ba786b1304b85e099eb3e69475698421adab01fd Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Sat, 22 Feb 2025 18:21:19 +0100 Subject: [PATCH 04/32] Upgrade thredded in order to prepare for Rails 7.2 upgrade --- Gemfile | 2 +- Gemfile.lock | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index 9862fdbb6..f4a686551 100644 --- a/Gemfile +++ b/Gemfile @@ -62,7 +62,7 @@ gem "sunspot_rails", "~> 2.7" gem "sunspot_solr", "~> 2.7" gem "terser", "~> 1.2" # Ruby wrapper for UglifyJS JavaScript compressor gem "thredded", git: "https://github.com/thredded/thredded.git", - ref: "1340e913affd1af5fcc060fbccd271184ece9a6a" + ref: "94fbf890a984527bab399c8c7f1eec7af7006843" gem "thredded-markdown_katex", git: "https://github.com/thredded/thredded-markdown_katex.git", ref: "e2830bdb40880018a0e59d2b82c94b0a9f237365" diff --git a/Gemfile.lock b/Gemfile.lock index 7f8dbd831..24616e4d0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,8 +9,8 @@ GIT GIT remote: https://github.com/thredded/thredded.git - revision: 1340e913affd1af5fcc060fbccd271184ece9a6a - ref: 1340e913affd1af5fcc060fbccd271184ece9a6a + revision: 94fbf890a984527bab399c8c7f1eec7af7006843 + ref: 94fbf890a984527bab399c8c7f1eec7af7006843 specs: thredded (1.1.0) active_record_union (>= 1.3.0) @@ -26,11 +26,10 @@ GIT nokogiri onebox (>= 1.8.99) pundit (>= 1.1.0) - rails (> 6.0.0.rc2) + rails (>= 7.0) rails_gravatar rinku sanitize - sassc-rails (>= 2.0.0) sprockets-es6 timeago_js (>= 3.0.2.2) @@ -327,7 +326,7 @@ GEM listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.6.5) + logger (1.6.6) loofah (2.24.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -352,18 +351,18 @@ GEM multipart-post (2.4.1) mustache (1.1.1) mutex_m (0.3.0) - net-imap (0.5.5) + net-imap (0.5.6) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol netrc (0.11.0) nio4r (2.7.4) - nokogiri (1.18.2-x86_64-linux-gnu) + nokogiri (1.18.3-x86_64-linux-gnu) racc (~> 1.4) onebox (2.2.19) addressable (~> 2.8.0) @@ -415,7 +414,7 @@ GEM activesupport (>= 3.0.0) raabro (1.4.0) racc (1.8.1) - rack (2.2.10) + rack (2.2.11) rack-proxy (0.7.7) rack rack-session (1.0.2) @@ -469,7 +468,7 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - rdoc (6.11.0) + rdoc (6.12.0) psych (>= 4.0.0) redis-client (0.23.2) connection_pool @@ -486,7 +485,7 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rexml (3.4.0) + rexml (3.4.1) rgl (0.6.6) pairing_heap (>= 0.3, < 4.0) rexml (~> 3.2, >= 3.2.4) @@ -602,7 +601,7 @@ GEM stream (0.5.5) streamio-ffmpeg (3.0.2) multi_json (~> 1.8) - stringio (3.1.2) + stringio (3.1.5) sunspot (2.7.1) bigdecimal pr_geohash (~> 1.0) @@ -654,7 +653,7 @@ GEM websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) will_paginate (4.0.1) - zeitwerk (2.6.18) + zeitwerk (2.7.2) PLATFORMS x86_64-linux From 15a68eb78501bb3ddff449c0794e2918ae74e9a4 Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Sat, 22 Feb 2025 18:28:57 +0100 Subject: [PATCH 05/32] Upgrade Rails gem to Rails 7.2.2.1 --- Gemfile | 2 +- Gemfile.lock | 130 ++++++++++++++++++++++++--------------------------- 2 files changed, 63 insertions(+), 69 deletions(-) diff --git a/Gemfile b/Gemfile index f4a686551..8d1c38562 100644 --- a/Gemfile +++ b/Gemfile @@ -46,7 +46,7 @@ gem "progress_bar", "~> 1.3" gem "prometheus_exporter", "~> 2.1" gem "puma", "~> 6.4" # app server gem "rack", "~> 2.2" -gem "rails", "~> 7.1.3" +gem "rails", "~> 7.2.2" gem "rails-i18n", "~> 7.0" gem "responders", "~> 3.1" gem "rgl", "~> 0.6" diff --git a/Gemfile.lock b/Gemfile.lock index 24616e4d0..32a9ede2f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -40,51 +40,46 @@ GEM RubyInline (3.14.1) ZenTest (~> 4.3) ZenTest (4.12.2) - actioncable (7.1.5.1) - actionpack (= 7.1.5.1) - activesupport (= 7.1.5.1) + actioncable (7.2.2.1) + actionpack (= 7.2.2.1) + activesupport (= 7.2.2.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.5.1) - actionpack (= 7.1.5.1) - activejob (= 7.1.5.1) - activerecord (= 7.1.5.1) - activestorage (= 7.1.5.1) - activesupport (= 7.1.5.1) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.1.5.1) - actionpack (= 7.1.5.1) - actionview (= 7.1.5.1) - activejob (= 7.1.5.1) - activesupport (= 7.1.5.1) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp + actionmailbox (7.2.2.1) + actionpack (= 7.2.2.1) + activejob (= 7.2.2.1) + activerecord (= 7.2.2.1) + activestorage (= 7.2.2.1) + activesupport (= 7.2.2.1) + mail (>= 2.8.0) + actionmailer (7.2.2.1) + actionpack (= 7.2.2.1) + actionview (= 7.2.2.1) + activejob (= 7.2.2.1) + activesupport (= 7.2.2.1) + mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.1.5.1) - actionview (= 7.1.5.1) - activesupport (= 7.1.5.1) + actionpack (7.2.2.1) + actionview (= 7.2.2.1) + activesupport (= 7.2.2.1) nokogiri (>= 1.8.5) racc - rack (>= 2.2.4) + rack (>= 2.2.4, < 3.2) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.5.1) - actionpack (= 7.1.5.1) - activerecord (= 7.1.5.1) - activestorage (= 7.1.5.1) - activesupport (= 7.1.5.1) + useragent (~> 0.16) + actiontext (7.2.2.1) + actionpack (= 7.2.2.1) + activerecord (= 7.2.2.1) + activestorage (= 7.2.2.1) + activesupport (= 7.2.2.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.5.1) - activesupport (= 7.1.5.1) + actionview (7.2.2.1) + activesupport (= 7.2.2.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) @@ -96,38 +91,37 @@ GEM jsonapi-renderer (>= 0.1.1.beta1, < 0.3) active_record_union (1.3.0) activerecord (>= 4.0) - activejob (7.1.5.1) - activesupport (= 7.1.5.1) + activejob (7.2.2.1) + activesupport (= 7.2.2.1) globalid (>= 0.3.6) - activemodel (7.1.5.1) - activesupport (= 7.1.5.1) - activerecord (7.1.5.1) - activemodel (= 7.1.5.1) - activesupport (= 7.1.5.1) + activemodel (7.2.2.1) + activesupport (= 7.2.2.1) + activerecord (7.2.2.1) + activemodel (= 7.2.2.1) + activesupport (= 7.2.2.1) timeout (>= 0.4.0) activerecord-import (1.8.1) activerecord (>= 4.2) activerecord-nulldb-adapter (1.1.1) activerecord (>= 6.0, < 8.1) - activestorage (7.1.5.1) - actionpack (= 7.1.5.1) - activejob (= 7.1.5.1) - activerecord (= 7.1.5.1) - activesupport (= 7.1.5.1) + activestorage (7.2.2.1) + actionpack (= 7.2.2.1) + activejob (= 7.2.2.1) + activerecord (= 7.2.2.1) + activesupport (= 7.2.2.1) marcel (~> 1.0) - activesupport (7.1.5.1) + activesupport (7.2.2.1) base64 benchmark (>= 0.3) bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) + concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) logger (>= 1.4.2) minitest (>= 5.1) - mutex_m securerandom (>= 0.3) - tzinfo (~> 2.0) + tzinfo (~> 2.0, >= 2.0.5) acts_as_list (1.2.4) activerecord (>= 6.1) activesupport (>= 6.1) @@ -350,7 +344,6 @@ GEM multi_json (1.15.0) multipart-post (2.4.1) mustache (1.1.1) - mutex_m (0.3.0) net-imap (0.5.6) date net-protocol @@ -424,20 +417,20 @@ GEM rackup (1.0.1) rack (< 3) webrick - rails (7.1.5.1) - actioncable (= 7.1.5.1) - actionmailbox (= 7.1.5.1) - actionmailer (= 7.1.5.1) - actionpack (= 7.1.5.1) - actiontext (= 7.1.5.1) - actionview (= 7.1.5.1) - activejob (= 7.1.5.1) - activemodel (= 7.1.5.1) - activerecord (= 7.1.5.1) - activestorage (= 7.1.5.1) - activesupport (= 7.1.5.1) + rails (7.2.2.1) + actioncable (= 7.2.2.1) + actionmailbox (= 7.2.2.1) + actionmailer (= 7.2.2.1) + actionpack (= 7.2.2.1) + actiontext (= 7.2.2.1) + actionview (= 7.2.2.1) + activejob (= 7.2.2.1) + activemodel (= 7.2.2.1) + activerecord (= 7.2.2.1) + activestorage (= 7.2.2.1) + activesupport (= 7.2.2.1) bundler (>= 1.15.0) - railties (= 7.1.5.1) + railties (= 7.2.2.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -455,10 +448,10 @@ GEM railties (>= 6.0.0, < 8) rails_gravatar (1.0.4) actionview - railties (7.1.5.1) - actionpack (= 7.1.5.1) - activesupport (= 7.1.5.1) - irb + railties (7.2.2.1) + actionpack (= 7.2.2.1) + activesupport (= 7.2.2.1) + irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) @@ -635,6 +628,7 @@ GEM unicode-display_width (3.1.4) unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) + useragent (0.16.11) warden (1.2.9) rack (>= 2.0.9) web-console (4.2.1) @@ -708,7 +702,7 @@ DEPENDENCIES prometheus_exporter (~> 2.1) puma (~> 6.4) rack (~> 2.2) - rails (~> 7.1.3) + rails (~> 7.2.2) rails-erd (~> 1.7) rails-i18n (~> 7.0) responders (~> 3.1) From 855edeaf867c1cf15b5d5f00e2438f5edd0c0866 Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Sat, 22 Feb 2025 19:13:09 +0100 Subject: [PATCH 06/32] Apply app:upgrade --- bin/rubocop | 8 ++ bin/setup | 9 ++- config/application.rb | 1 - config/environments/development.rb | 7 ++ config/environments/production.rb | 31 +++++++- .../new_framework_defaults_7_2.rb | 70 ++++++++++++++++++ config/puma.rb | 47 +++++++----- public/406-unsupported-browser.html | 66 +++++++++++++++++ public/icon.png | Bin 0 -> 5599 bytes public/icon.svg | 3 + public/robots.txt | 2 +- 11 files changed, 218 insertions(+), 26 deletions(-) create mode 100755 bin/rubocop create mode 100644 config/initializers/new_framework_defaults_7_2.rb create mode 100644 public/406-unsupported-browser.html create mode 100644 public/icon.png create mode 100644 public/icon.svg diff --git a/bin/rubocop b/bin/rubocop new file mode 100755 index 000000000..40330c0ff --- /dev/null +++ b/bin/rubocop @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +require "rubygems" +require "bundler/setup" + +# explicit rubocop config increases performance slightly while avoiding config confusion. +ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__)) + +load Gem.bin_path("rubocop", "rubocop") diff --git a/bin/setup b/bin/setup index 2cc479483..f73363809 100755 --- a/bin/setup +++ b/bin/setup @@ -1,8 +1,8 @@ #!/usr/bin/env ruby require "fileutils" -# path to your application root. APP_ROOT = File.expand_path("..", __dir__) +APP_NAME = "mampf" def system!(*args) system(*args, exception: true) @@ -17,9 +17,6 @@ FileUtils.chdir APP_ROOT do system! "gem install bundler --conservative" system("bundle check") || system!("bundle install") - # Install JavaScript dependencies - system! 'bin/yarn' - # puts "\n== Copying sample files ==" # unless File.exist?("config/database.yml") # FileUtils.cp "config/database.yml.sample", "config/database.yml" @@ -33,4 +30,8 @@ FileUtils.chdir APP_ROOT do puts "\n== Restarting application server ==" system! "bin/rails restart" + + # puts "\n== Configuring puma-dev ==" + # system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}" + # system "curl -Is https://#{APP_NAME}.test/up | head -n 1" end diff --git a/config/application.rb b/config/application.rb index de5fae844..f36989016 100644 --- a/config/application.rb +++ b/config/application.rb @@ -10,7 +10,6 @@ module Mampf class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults(7.1) - config.autoloader = :zeitwerk # Autoload subfolders of modules (recursively) # https://stackoverflow.com/a/4794775/ diff --git a/config/environments/development.rb b/config/environments/development.rb index c6529aa9d..8c1e9f7ca 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -83,4 +83,11 @@ # Uncomment if you wish to allow Action Cable access from any origin. # config.action_cable.disable_request_forgery_protection = true + # + + # Raise error when a before_action's only/except options reference missing actions. + config.action_controller.raise_on_missing_callback_actions = true + + # Apply autocorrection by RuboCop to files generated by `bin/rails generate`. + # config.generators.apply_rubocop_autocorrect_after_generate! end diff --git a/config/environments/production.rb b/config/environments/production.rb index 7f0f4cec4..0fdff9720 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -17,7 +17,7 @@ # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], # config/master.key, or an environment key such as config/credentials/production.key. # This key is used to decrypt credentials (and other encrypted files). - config.require_master_key = true + # config.require_master_key = true # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead. config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? @@ -29,6 +29,9 @@ # Do not fall back 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.asset_host = "http://assets.example.com" + # 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 @@ -39,6 +42,21 @@ # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = Logger::Formatter.new + # 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.*/ ] + + # Assume all access to the app is happening through a SSL-terminating reverse proxy. + # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies. + # config.assume_ssl = true + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Skip http-to-https redirect for the default health check endpoint. + # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } } + if ENV["RAILS_LOG_TO_STDOUT"].present? config.logger = ActiveSupport::Logger.new($stdout) .tap { |logger| logger.formatter = config.log_formatter } @@ -83,4 +101,15 @@ production_name = ENV.fetch("PRODUCTION_NAME", nil) Rails.logger.info("PRODUCTION_NAME: #{production_name}") end + + # See https://github.com/rails/rails/issues/52728 + config.active_record.attributes_for_inspect = :all + + # Enable DNS rebinding protection and other `Host` header attacks. + # config.hosts = [ + # "example.com", # Allow requests from example.com + # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com` + # ] + # Skip DNS rebinding protection for the default health check endpoint. + # config.host_authorization = { exclude: ->(request) { request.path == "/up" } } end diff --git a/config/initializers/new_framework_defaults_7_2.rb b/config/initializers/new_framework_defaults_7_2.rb new file mode 100644 index 000000000..b549c4a25 --- /dev/null +++ b/config/initializers/new_framework_defaults_7_2.rb @@ -0,0 +1,70 @@ +# Be sure to restart your server when you modify this file. +# +# This file eases your Rails 7.2 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.2`. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. +# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html + +### +# Controls whether Active Job's `#perform_later` and similar methods automatically defer +# the job queuing to after the current Active Record transaction is committed. +# +# Example: +# Topic.transaction do +# topic = Topic.create(...) +# NewTopicNotificationJob.perform_later(topic) +# end +# +# In this example, if the configuration is set to `:never`, the job will +# be enqueued immediately, even though the `Topic` hasn't been committed yet. +# Because of this, if the job is picked up almost immediately, or if the +# transaction doesn't succeed for some reason, the job will fail to find this +# topic in the database. +# +# If `enqueue_after_transaction_commit` is set to `:default`, the queue adapter +# will define the behaviour. +# +# Note: Active Job backends can disable this feature. This is generally done by +# backends that use the same database as Active Record as a queue, hence they +# don't need this feature. +#++ +# Rails.application.config.active_job.enqueue_after_transaction_commit = :default + +### +# Adds image/webp to the list of content types Active Storage considers as an image +# Prevents automatic conversion to a fallback PNG, and assumes clients support WebP, as they support gif, jpeg, and png. +# This is possible due to broad browser support for WebP, but older browsers and email clients may still not support +# WebP. Requires imagemagick/libvips built with WebP support. +#++ +# Rails.application.config.active_storage.web_image_content_types = %w[image/png image/jpeg image/gif image/webp] + +### +# Enable validation of migration timestamps. When set, an ActiveRecord::InvalidMigrationTimestampError +# will be raised if the timestamp prefix for a migration is more than a day ahead of the timestamp +# associated with the current time. This is done to prevent forward-dating of migration files, which can +# impact migration generation and other migration commands. +# +# Applications with existing timestamped migrations that do not adhere to the +# expected format can disable validation by setting this config to `false`. +#++ +# Rails.application.config.active_record.validate_migration_timestamps = true + +### +# Controls whether the PostgresqlAdapter should decode dates automatically with manual queries. +# +# Example: +# ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.select_value("select '2024-01-01'::date") #=> Date +# +# This query used to return a `String`. +#++ +# Rails.application.config.active_record.postgresql_adapter_decode_dates = true + +### +# Enables YJIT as of Ruby 3.3, to bring sizeable performance improvements. If you are +# deploying to a memory constrained environment you may want to set this to `false`. +#++ +# Rails.application.config.yjit = true diff --git a/config/puma.rb b/config/puma.rb index 06209aa8b..03c166f4c 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,25 +1,34 @@ -# Puma can serve each request in a thread from an internal thread pool. -# The `threads` method setting takes two numbers: a minimum and maximum. -# Any libraries that use thread pools should be configured to match -# the maximum value specified for Puma. Default is set to 5 threads for minimum -# and maximum; this matches the default thread size of Active Record. +# This configuration file will be evaluated by Puma. The top-level methods that +# are invoked here are part of Puma's configuration DSL. For more information +# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html. -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 - -# Specifies the `worker_timeout` threshold that Puma will use to wait before -# terminating a worker in development environments. -worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" +# Puma starts a configurable number of processes (workers) and each process +# serves each request in a thread from an internal thread pool. +# +# The ideal number of threads per worker depends both on how much time the +# application spends waiting for IO operations and on how much you wish to +# to prioritize throughput over latency. +# +# As a rule of thumb, increasing the number of threads will increase how much +# traffic a given process can handle (throughput), but due to CRuby's +# Global VM Lock (GVL) it has diminishing returns and will degrade the +# response time (latency) of the application. +# +# The default is set to 3 threads as it's deemed a decent compromise between +# throughput and latency for the average Rails application. +# +# Any libraries that use a connection pool or another resource pool should +# be configured to provide at least as many connections as the number of +# threads. This includes Active Record's `pool` parameter in `database.yml`. +threads_count = ENV.fetch("RAILS_MAX_THREADS", 3) +threads threads_count, threads_count # Specifies the `port` that Puma will listen on to receive requests; default is 3000. port ENV.fetch("PORT", 3000) -# Specifies the `environment` that Puma will run in. -environment ENV.fetch("RAILS_ENV") { "development" } - -# Specifies the `pidfile` that Puma will use. -pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } - -# Allow puma to be restarted by `rails restart` command. +# Allow puma to be restarted by `bin/rails restart` command. plugin :tmp_restart + +# Specify the PID file. Defaults to tmp/pids/server.pid in development. +# In other environments, only set the PID file if requested. +pidfile ENV["PIDFILE"] if ENV["PIDFILE"] diff --git a/public/406-unsupported-browser.html b/public/406-unsupported-browser.html new file mode 100644 index 000000000..7cf1e168e --- /dev/null +++ b/public/406-unsupported-browser.html @@ -0,0 +1,66 @@ + + + + Your browser is not supported (406) + + + + + + +
+
+

Your browser is not supported.

+

Please upgrade your browser to continue.

+
+
+ + diff --git a/public/icon.png b/public/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..f3b5abcbde91cf6d7a6a26e514eb7e30f476f950 GIT binary patch literal 5599 zcmeHL-D}fO6hCR_taXJlzs3}~RuB=Iujyo=i*=1|1FN%E=zNfMTjru|Q<6v{J{U!C zBEE}?j6I3sz>fzN!6}L_BKjcuASk~1;Dg|U_@d{g?V8mM`~#9U+>>*Ezw>c(PjYWA z4(;!cgge6k5E&d$G5`S-0}!Ik>CV(0Y#1}s-v_gAHhja2=W1?nBAte9D2HG<(+)uj z!5=W4u*{VKMw#{V@^NNs4TClr!FAA%ID-*gc{R%CFKEzG<6gm*9s_uy)oMGW*=nJf zw{(Mau|2FHfXIv6C0@Wk5k)F=3jo1srV-C{pl&k&)4_&JjYrnbJiul}d0^NCSh(#7h=F;3{|>EU>h z6U8_p;^wK6mAB(1b92>5-HxJ~V}@3?G`&Qq-TbJ2(&~-HsH6F#8mFaAG(45eT3VPO zM|(Jd<+;UZs;w>0Qw}0>D%{~r{uo_Fl5_Bo3ABWi zWo^j^_T3dxG6J6fH8X)$a^%TJ#PU!=LxF=#Fd9EvKx_x>q<(KY%+y-08?kN9dXjXK z**Q=yt-FTU*13ouhCdqq-0&;Ke{T3sQU9IdzhV9LhQIpq*P{N)+}|Mh+a-VV=x?R} c>%+pvTcMWshj-umO}|qP?%A)*_KlqT3uEqhU;qFB literal 0 HcmV?d00001 diff --git a/public/icon.svg b/public/icon.svg new file mode 100644 index 000000000..78307ccd4 --- /dev/null +++ b/public/icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/robots.txt b/public/robots.txt index 37b576a4a..c19f78ab6 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1 +1 @@ -# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file +# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file From 8f0ab9e7227d53d51eeaaea54d94b785d27af32f Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Sat, 22 Feb 2025 19:23:50 +0100 Subject: [PATCH 07/32] Flip switches for Rais 7.2 migration --- config/initializers/new_framework_defaults_7_2.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/config/initializers/new_framework_defaults_7_2.rb b/config/initializers/new_framework_defaults_7_2.rb index b549c4a25..19426d7d8 100644 --- a/config/initializers/new_framework_defaults_7_2.rb +++ b/config/initializers/new_framework_defaults_7_2.rb @@ -32,7 +32,7 @@ # backends that use the same database as Active Record as a queue, hence they # don't need this feature. #++ -# Rails.application.config.active_job.enqueue_after_transaction_commit = :default +Rails.application.config.active_job.enqueue_after_transaction_commit = :default ### # Adds image/webp to the list of content types Active Storage considers as an image @@ -40,7 +40,8 @@ # This is possible due to broad browser support for WebP, but older browsers and email clients may still not support # WebP. Requires imagemagick/libvips built with WebP support. #++ -# Rails.application.config.active_storage.web_image_content_types = %w[image/png image/jpeg image/gif image/webp] +Rails.application.config.active_storage.web_image_content_types = ["image/png", "image/jpeg", + "image/gif", "image/webp"] ### # Enable validation of migration timestamps. When set, an ActiveRecord::InvalidMigrationTimestampError @@ -51,7 +52,7 @@ # Applications with existing timestamped migrations that do not adhere to the # expected format can disable validation by setting this config to `false`. #++ -# Rails.application.config.active_record.validate_migration_timestamps = true +Rails.application.config.active_record.validate_migration_timestamps = true ### # Controls whether the PostgresqlAdapter should decode dates automatically with manual queries. @@ -61,10 +62,10 @@ # # This query used to return a `String`. #++ -# Rails.application.config.active_record.postgresql_adapter_decode_dates = true +Rails.application.config.active_record.postgresql_adapter_decode_dates = true ### # Enables YJIT as of Ruby 3.3, to bring sizeable performance improvements. If you are # deploying to a memory constrained environment you may want to set this to `false`. #++ -# Rails.application.config.yjit = true +Rails.application.config.yjit = true From 75a1a56957cfd84c98f1a2c7d7de104864317cc7 Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Sat, 22 Feb 2025 19:26:25 +0100 Subject: [PATCH 08/32] Enforce Rubocop rules --- .../initializers/new_framework_defaults_7_2.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/config/initializers/new_framework_defaults_7_2.rb b/config/initializers/new_framework_defaults_7_2.rb index 19426d7d8..54de830b4 100644 --- a/config/initializers/new_framework_defaults_7_2.rb +++ b/config/initializers/new_framework_defaults_7_2.rb @@ -36,18 +36,20 @@ ### # Adds image/webp to the list of content types Active Storage considers as an image -# Prevents automatic conversion to a fallback PNG, and assumes clients support WebP, as they support gif, jpeg, and png. -# This is possible due to broad browser support for WebP, but older browsers and email clients may still not support -# WebP. Requires imagemagick/libvips built with WebP support. +# Prevents automatic conversion to a fallback PNG, and assumes clients support WebP, as +# they support gif, jpeg, and png. +# This is possible due to broad browser support for WebP, but older browsers and email clients +# may still not support WebP. Requires imagemagick/libvips built with WebP support. #++ Rails.application.config.active_storage.web_image_content_types = ["image/png", "image/jpeg", "image/gif", "image/webp"] ### -# Enable validation of migration timestamps. When set, an ActiveRecord::InvalidMigrationTimestampError +# Enable validation of migration timestamps. When set, an +# ActiveRecord::InvalidMigrationTimestampError # will be raised if the timestamp prefix for a migration is more than a day ahead of the timestamp -# associated with the current time. This is done to prevent forward-dating of migration files, which can -# impact migration generation and other migration commands. +# associated with the current time. This is done to prevent forward-dating of migration +# files, which can impact migration generation and other migration commands. # # Applications with existing timestamped migrations that do not adhere to the # expected format can disable validation by setting this config to `false`. @@ -58,7 +60,8 @@ # Controls whether the PostgresqlAdapter should decode dates automatically with manual queries. # # Example: -# ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.select_value("select '2024-01-01'::date") #=> Date +# ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.select_value("select '2024-01-01'::date") # +# => Date # # This query used to return a `String`. #++ From 77949308e002271445066cf90efb0b1aa4d3aa3e Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Sat, 22 Feb 2025 20:05:22 +0100 Subject: [PATCH 09/32] Add mutex_m in order to silence Ruby 3.4 warnings --- Gemfile | 1 + Gemfile.lock | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Gemfile b/Gemfile index 8d1c38562..215b96f7b 100644 --- a/Gemfile +++ b/Gemfile @@ -73,6 +73,7 @@ gem "webpacker", "~> 5.4" group :development, :docker_development do gem "listen", "~> 3.9" gem "marcel", "~> 1.0" + gem "mutex_m", "~> 0.3" # silence warning: no longer part of default gems for Ruby >=3.4.0 gem "pgreset", "~> 0.4" gem "rails-erd", "~> 1.7" gem "rubocop", "~> 1.65", require: false diff --git a/Gemfile.lock b/Gemfile.lock index 32a9ede2f..035b6a877 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -344,6 +344,7 @@ GEM multi_json (1.15.0) multipart-post (2.4.1) mustache (1.1.1) + mutex_m (0.3.0) net-imap (0.5.6) date net-protocol @@ -693,6 +694,7 @@ DEPENDENCIES marcel (~> 1.0) mini_magick (~> 4.13) mobility (~> 1.2) + mutex_m (~> 0.3) net-smtp (~> 0.5) pdf-reader (~> 2.12) pg (~> 1.5) From 811d874acbbfc3ee2b400adf0c26ab7fc33e1f05 Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Sat, 22 Feb 2025 20:06:39 +0100 Subject: [PATCH 10/32] Use Rails 7.2 defaults --- config/application.rb | 2 +- .../new_framework_defaults_7_2.rb | 74 ------------------- 2 files changed, 1 insertion(+), 75 deletions(-) delete mode 100644 config/initializers/new_framework_defaults_7_2.rb diff --git a/config/application.rb b/config/application.rb index f36989016..be78e6e80 100644 --- a/config/application.rb +++ b/config/application.rb @@ -9,7 +9,7 @@ module Mampf class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults(7.1) + config.load_defaults(7.2) # Autoload subfolders of modules (recursively) # https://stackoverflow.com/a/4794775/ diff --git a/config/initializers/new_framework_defaults_7_2.rb b/config/initializers/new_framework_defaults_7_2.rb deleted file mode 100644 index 54de830b4..000000000 --- a/config/initializers/new_framework_defaults_7_2.rb +++ /dev/null @@ -1,74 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file eases your Rails 7.2 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.2`. -# -# Read the Guide for Upgrading Ruby on Rails for more info on each option. -# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html - -### -# Controls whether Active Job's `#perform_later` and similar methods automatically defer -# the job queuing to after the current Active Record transaction is committed. -# -# Example: -# Topic.transaction do -# topic = Topic.create(...) -# NewTopicNotificationJob.perform_later(topic) -# end -# -# In this example, if the configuration is set to `:never`, the job will -# be enqueued immediately, even though the `Topic` hasn't been committed yet. -# Because of this, if the job is picked up almost immediately, or if the -# transaction doesn't succeed for some reason, the job will fail to find this -# topic in the database. -# -# If `enqueue_after_transaction_commit` is set to `:default`, the queue adapter -# will define the behaviour. -# -# Note: Active Job backends can disable this feature. This is generally done by -# backends that use the same database as Active Record as a queue, hence they -# don't need this feature. -#++ -Rails.application.config.active_job.enqueue_after_transaction_commit = :default - -### -# Adds image/webp to the list of content types Active Storage considers as an image -# Prevents automatic conversion to a fallback PNG, and assumes clients support WebP, as -# they support gif, jpeg, and png. -# This is possible due to broad browser support for WebP, but older browsers and email clients -# may still not support WebP. Requires imagemagick/libvips built with WebP support. -#++ -Rails.application.config.active_storage.web_image_content_types = ["image/png", "image/jpeg", - "image/gif", "image/webp"] - -### -# Enable validation of migration timestamps. When set, an -# ActiveRecord::InvalidMigrationTimestampError -# will be raised if the timestamp prefix for a migration is more than a day ahead of the timestamp -# associated with the current time. This is done to prevent forward-dating of migration -# files, which can impact migration generation and other migration commands. -# -# Applications with existing timestamped migrations that do not adhere to the -# expected format can disable validation by setting this config to `false`. -#++ -Rails.application.config.active_record.validate_migration_timestamps = true - -### -# Controls whether the PostgresqlAdapter should decode dates automatically with manual queries. -# -# Example: -# ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.select_value("select '2024-01-01'::date") # -# => Date -# -# This query used to return a `String`. -#++ -Rails.application.config.active_record.postgresql_adapter_decode_dates = true - -### -# Enables YJIT as of Ruby 3.3, to bring sizeable performance improvements. If you are -# deploying to a memory constrained environment you may want to set this to `false`. -#++ -Rails.application.config.yjit = true From ca1fa1c588f37da57e40e4f1c6a0a164033f579f Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Sat, 22 Feb 2025 20:28:43 +0100 Subject: [PATCH 11/32] Replace keyword argument syntax by positional arguments in order to fix deprecation warning --- app/models/annotation.rb | 4 ++-- app/models/voucher/voucher.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/annotation.rb b/app/models/annotation.rb index 6ee3ec804..7e975af5f 100644 --- a/app/models/annotation.rb +++ b/app/models/annotation.rb @@ -9,8 +9,8 @@ class Annotation < ApplicationRecord # the timestamp for the annotation position is serialized as text in the db serialize :timestamp, coder: TimeStamp - enum category: { note: 0, content: 1, mistake: 2, presentation: 3 } - enum subcategory: { definition: 0, argument: 1, strategy: 2 } + enum :category, { note: 0, content: 1, mistake: 2, presentation: 3 } + enum :subcategory, { definition: 0, argument: 1, strategy: 2 } # If the annotation has an associated commontator comment, its comment will # be saved in the commontator comment. While calling annotation.comment returns diff --git a/app/models/voucher/voucher.rb b/app/models/voucher/voucher.rb index ccd1ac2da..04a03a996 100644 --- a/app/models/voucher/voucher.rb +++ b/app/models/voucher/voucher.rb @@ -20,7 +20,7 @@ class Voucher < ApplicationRecord DEFAULT_EXPIRATION_DAYS = 3 ROLE_HASH = { tutor: 0, editor: 1, teacher: 2, speaker: 3 }.freeze - enum role: ROLE_HASH + enum :role, ROLE_HASH validates :role, presence: true belongs_to :lecture, touch: true From 90195db1f1d620a15354eb4cf0fdecc174b1704f Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Sat, 22 Feb 2025 20:29:12 +0100 Subject: [PATCH 12/32] Update schemas to Rails 7.2 --- db/interactions_schema.rb | 3 +-- db/schema.rb | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/db/interactions_schema.rb b/db/interactions_schema.rb index 4440cb9b3..6d1f84187 100644 --- a/db/interactions_schema.rb +++ b/db/interactions_schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2020_06_13_112557) do +ActiveRecord::Schema[7.2].define(version: 2020_06_13_112557) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -43,5 +43,4 @@ t.text "input" t.integer "remark_id" end - end diff --git a/db/schema.rb b/db/schema.rb index 0a6d204ba..5bf3c6785 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_09_21_221000) do +ActiveRecord::Schema[7.2].define(version: 2024_09_21_221000) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" From 4382a8b2a90b4031cdcb4890fa5b358267fa5d2b Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Sat, 22 Feb 2025 20:42:46 +0100 Subject: [PATCH 13/32] Add csv gem in order to silence deprecation warning --- Gemfile | 1 + Gemfile.lock | 2 ++ app/models/interaction.rb | 1 - 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 215b96f7b..08defe595 100644 --- a/Gemfile +++ b/Gemfile @@ -19,6 +19,7 @@ gem "clipboard-rails", "~> 1.7" gem "coffee-rails", "~> 5.0" # CoffeeScript for .coffee assets and views gem "commontator", "~> 7.0.1" gem "coveralls", "~> 0.7", require: false +gem "csv", "~> 3.3" gem "dalli", "~> 3.2" # caching to memcached in production gem "devise", "~> 4.9" gem "devise-bootstrap-views", "~> 1.1" diff --git a/Gemfile.lock b/Gemfile.lock index 035b6a877..3b2818270 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -183,6 +183,7 @@ GEM crass (1.0.6) css_parser (1.21.0) addressable + csv (3.3.2) dalli (3.2.8) database_cleaner-active_record (2.2.0) activerecord (>= 5.a) @@ -670,6 +671,7 @@ DEPENDENCIES coffee-rails (~> 5.0) commontator (~> 7.0.1) coveralls (~> 0.7) + csv (~> 3.3) dalli (~> 3.2) database_cleaner-active_record (~> 2.2) devise (~> 4.9) diff --git a/app/models/interaction.rb b/app/models/interaction.rb index 87e8331a2..8e9847305 100644 --- a/app/models/interaction.rb +++ b/app/models/interaction.rb @@ -2,7 +2,6 @@ class Interaction < InteractionsRecord scope :created_between, lambda { |start_date, end_date| where(created_at: start_date.beginning_of_day..end_date.end_of_day) } - require "csv" def self.to_csv attributes = ["id", "session_id", "created_at", "full_path", "referrer_url", From b7b24333bf66f34bd8cbd0777b0d92c176bc6846 Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Sat, 22 Feb 2025 20:47:47 +0100 Subject: [PATCH 14/32] Remove explicit requiring of csv --- Gemfile | 2 +- app/models/probe.rb | 1 - app/models/tutorial.rb | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 08defe595..049ba7203 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ gem "clipboard-rails", "~> 1.7" gem "coffee-rails", "~> 5.0" # CoffeeScript for .coffee assets and views gem "commontator", "~> 7.0.1" gem "coveralls", "~> 0.7", require: false -gem "csv", "~> 3.3" +gem "csv", "~> 3.3" # silence warning: no longer part of default gems for Ruby >=3.4.0 gem "dalli", "~> 3.2" # caching to memcached in production gem "devise", "~> 4.9" gem "devise-bootstrap-views", "~> 1.1" diff --git a/app/models/probe.rb b/app/models/probe.rb index 7de065442..83cacd148 100644 --- a/app/models/probe.rb +++ b/app/models/probe.rb @@ -2,7 +2,6 @@ class Probe < InteractionsRecord scope :created_between, lambda { |start_date, end_date| where(created_at: start_date.beginning_of_day..end_date.end_of_day) } - require "csv" def self.finished_quizzes(quiz) Probe.where(quiz_id: quiz.id, progress: -1).count diff --git a/app/models/tutorial.rb b/app/models/tutorial.rb index 8fd72418a..31f281d4f 100644 --- a/app/models/tutorial.rb +++ b/app/models/tutorial.rb @@ -1,7 +1,5 @@ # Tutorial model class Tutorial < ApplicationRecord - require "csv" - belongs_to :lecture, touch: true has_many :tutor_tutorial_joins, dependent: :destroy From 77b68fc37034d33f1e5bf78d6cf6794e27b35053 Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Sat, 22 Feb 2025 21:25:36 +0100 Subject: [PATCH 15/32] Add config changes from development to docker_development --- config/environments/docker_development.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/environments/docker_development.rb b/config/environments/docker_development.rb index f2be5f19d..f01c6f2e5 100644 --- a/config/environments/docker_development.rb +++ b/config/environments/docker_development.rb @@ -90,4 +90,10 @@ config.web_console.allowed_ips = Socket.ip_address_list.reduce([]) do |res, addrinfo| addrinfo.ipv4? ? res << IPAddr.new(addrinfo.ip_address).mask(24) : res end + + # Raise error when a before_action's only/except options reference missing actions. + config.action_controller.raise_on_missing_callback_actions = true + + # Apply autocorrection by RuboCop to files generated by `bin/rails generate`. + # config.generators.apply_rubocop_autocorrect_after_generate! end From 7f3437b6a44aea07555ddce850891a0df2fcf48f Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Sat, 22 Feb 2025 21:30:17 +0100 Subject: [PATCH 16/32] Replace remaining old ruby versions --- .github/workflows/linter.yml | 2 +- docker/production/Dockerfile | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 230aafd40..f864924d6 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -27,7 +27,7 @@ jobs: if: ${{ steps.rb-changed.outputs.changed-files != ''}} uses: ruby/setup-ruby@v1 with: - ruby-version: 3.1.4 + ruby-version: 3.3.7 bundler-cache: true - name: Run RuboCop diff --git a/docker/production/Dockerfile b/docker/production/Dockerfile index 92d8d67c3..bd1362dea 100644 --- a/docker/production/Dockerfile +++ b/docker/production/Dockerfile @@ -7,7 +7,7 @@ RUN GOOS=js GOARCH=wasm go build -o pdfcomprezzor.wasm RUN cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" . # Now build the actual mampf application -FROM ruby:3.1.4 +FROM ruby:3.3.7-bullseye ENV RAILS_ENV=production @@ -17,7 +17,7 @@ EXPOSE 9394 ENTRYPOINT ["/usr/src/app/docker/entrypoint-worker.sh"] # use "--login" option, so that .bashrc is sourced in new shells -SHELL ["/bin/bash", "--login", "-c"] +SHELL ["/bin/bash", "--login", "-c"] # Install Node.js # https://github.com/nodesource/distributions/issues/1583#issuecomment-1597489401 @@ -106,7 +106,7 @@ COPY --chown=app:app . /usr/src/app # file and source it here in the Dockerfile just to have the precompile task run # successfully (this task doesn't even rely on the actual values, so despite # being a hack, it should be fine). -# +# # I've written down more details in this question on StackOverflow: # https://stackoverflow.com/q/78098380/ COPY ./docker/production/docker.env ./docker-dummy.env From 7e14a3c09524f10b54cb889d7307595017a7c0be Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Sat, 22 Feb 2025 22:01:35 +0100 Subject: [PATCH 17/32] Enforce Rubocop rules --- app/helpers/email_helper.rb | 4 ++-- lib/clients/erdbeere_client.rb | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/helpers/email_helper.rb b/app/helpers/email_helper.rb index 1031b37fc..b2f485f46 100644 --- a/app/helpers/email_helper.rb +++ b/app/helpers/email_helper.rb @@ -1,6 +1,6 @@ module EmailHelper - def email_image_tag(image, **options) + def email_image_tag(image, **) attachments.inline[image] = Rails.root.join("public/#{image}").read - image_tag(attachments[image].url, **options) + image_tag(attachments[image].url, **) end end diff --git a/lib/clients/erdbeere_client.rb b/lib/clients/erdbeere_client.rb index 37c2edead..c02f04dc4 100644 --- a/lib/clients/erdbeere_client.rb +++ b/lib/clients/erdbeere_client.rb @@ -2,12 +2,11 @@ module Clients class ErdbeereClient Response = Struct.new(:status, :body) - def self.get(path, params: nil, headers: {}, &block) + def self.get(path, params: nil, headers: {}, &) headers = headers.dup headers["Host"] = "localhost" if Rails.env.docker_development? - ERDBEERE_CONNECTION.get(path, params, headers, &block) + ERDBEERE_CONNECTION.get(path, params, headers, &) rescue Faraday::Error => e - pp("---------------------------------") Rails.logger.error("ErdbeereClient.get error: #{e.message}") Response.new(500, { error: e.message }.to_json) end From cbf17ff90b8f319902a0f855ec0991edbe2f8b3e Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Sat, 22 Feb 2025 23:55:08 +0100 Subject: [PATCH 18/32] Add missing require --- config/environments/test.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/environments/test.rb b/config/environments/test.rb index 6031f4365..e2c369e87 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,5 @@ +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 From e11da52f8883b0df1ec9eb84193a010c81965eef Mon Sep 17 00:00:00 2001 From: Splines Date: Fri, 2 May 2025 18:44:17 +0200 Subject: [PATCH 19/32] Use Debian bookworm instead of bullseye & update to ruby 3.3.8 (instead of ruby 3.3.7) --- .github/workflows/linter.yml | 2 +- Gemfile | 2 +- Gemfile.lock | 2 +- docker/development/Dockerfile | 4 ++-- docker/production/Dockerfile | 3 ++- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index f864924d6..e256c99af 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -27,7 +27,7 @@ jobs: if: ${{ steps.rb-changed.outputs.changed-files != ''}} uses: ruby/setup-ruby@v1 with: - ruby-version: 3.3.7 + ruby-version: 3.3.8 bundler-cache: true - name: Run RuboCop diff --git a/Gemfile b/Gemfile index d6f98630f..9718b151e 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" # We only pin versions to specific Git commits when they are "problem childs" # and we want to review each commit before updating to the latest version. -ruby "3.3.7" +ruby "3.3.8" gem "active_model_serializers", "~> 0.10" gem "activerecord-import", "~>1.7" diff --git a/Gemfile.lock b/Gemfile.lock index df134ff2a..16d790839 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -782,7 +782,7 @@ DEPENDENCIES webpacker (~> 5.4) RUBY VERSION - ruby 3.3.7p123 + ruby 3.3.8p144 BUNDLED WITH 2.6.8 diff --git a/docker/development/Dockerfile b/docker/development/Dockerfile index 542e378f7..7368da963 100644 --- a/docker/development/Dockerfile +++ b/docker/development/Dockerfile @@ -11,7 +11,7 @@ RUN cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" . # Now build the actual MaMpf application # https://hub.docker.com/_/ruby/ -FROM ruby:3.3.7-bullseye +FROM ruby:3.3.8-bookworm EXPOSE 3000 EXPOSE 9394 @@ -50,7 +50,7 @@ RUN which yarn; yarn --version RUN yarn set version "${YARN_VERSION}" # Install other dependencies -# Note that postgresql-client-13 is available through debian bullseye +# Note that postgresql-client-13 is available through debian bookworm # that the ruby image is based on RUN apt update && \ apt-get install -y --no-install-recommends \ diff --git a/docker/production/Dockerfile b/docker/production/Dockerfile index 5cc1f41c4..aa81bba20 100644 --- a/docker/production/Dockerfile +++ b/docker/production/Dockerfile @@ -7,7 +7,8 @@ RUN GOOS=js GOARCH=wasm go build -o pdfcomprezzor.wasm RUN cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" . # Now build the actual mampf application -FROM ruby:3.3.7-bullseye +# https://hub.docker.com/_/ruby/ +FROM ruby:3.3.8-bookworm ENV RAILS_ENV=production From 61997f9f0783216a0d60ee878e67c5ad971a5d38 Mon Sep 17 00:00:00 2001 From: Splines Date: Fri, 2 May 2025 18:46:47 +0200 Subject: [PATCH 20/32] Update to latest thredded version --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 9718b151e..8bcdeb279 100644 --- a/Gemfile +++ b/Gemfile @@ -64,7 +64,7 @@ gem "sunspot_rails", "~> 2.7" gem "sunspot_solr", "~> 2.7" gem "terser", "~> 1.2" # Ruby wrapper for UglifyJS JavaScript compressor gem "thredded", git: "https://github.com/thredded/thredded.git", - ref: "94fbf890a984527bab399c8c7f1eec7af7006843" + ref: "566100f6a020ccc390aa60689d58b007a55506d2" gem "thredded-markdown_katex", git: "https://github.com/thredded/thredded-markdown_katex.git", ref: "e2830bdb40880018a0e59d2b82c94b0a9f237365" diff --git a/Gemfile.lock b/Gemfile.lock index 16d790839..3c8866e51 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,8 +9,8 @@ GIT GIT remote: https://github.com/thredded/thredded.git - revision: 94fbf890a984527bab399c8c7f1eec7af7006843 - ref: 94fbf890a984527bab399c8c7f1eec7af7006843 + revision: 566100f6a020ccc390aa60689d58b007a55506d2 + ref: 566100f6a020ccc390aa60689d58b007a55506d2 specs: thredded (1.1.0) active_record_union (>= 1.3.0) From 19d726beec30caddc295651181188dfa6dc0f93a Mon Sep 17 00:00:00 2001 From: Splines Date: Fri, 2 May 2025 19:50:16 +0200 Subject: [PATCH 21/32] Force SSL in production --- config/environments/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 1444c98f7..1d1f35028 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -52,7 +52,7 @@ # config.assume_ssl = true # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true + config.force_ssl = true # Skip http-to-https redirect for the default health check endpoint. # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } } From af6665c3a189aa465bcdaef75f0dffa61c41d758 Mon Sep 17 00:00:00 2001 From: Splines Date: Fri, 2 May 2025 21:17:15 +0200 Subject: [PATCH 22/32] Update postgresql in dev to v15 Debian Bookworm (12) only ships postgresql-client-15 and no longer v13 [1]. Therefore, we update postgresl for the local setup. We can then update the postgresql version on the server at a later stage and first try to make sure that locally everything works fine. [1] https://packages.debian.org/bookworm/postgresql-client --- docker/development/Dockerfile | 4 +--- docker/development/docker-compose.yml | 2 +- docker/test/docker-compose.yml | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docker/development/Dockerfile b/docker/development/Dockerfile index 7368da963..734b6f956 100644 --- a/docker/development/Dockerfile +++ b/docker/development/Dockerfile @@ -50,12 +50,10 @@ RUN which yarn; yarn --version RUN yarn set version "${YARN_VERSION}" # Install other dependencies -# Note that postgresql-client-13 is available through debian bookworm -# that the ruby image is based on RUN apt update && \ apt-get install -y --no-install-recommends \ ffmpeg imagemagick pdftk ghostscript shared-mime-info \ - libarchive-tools postgresql-client-13 wget wait-for-it graphviz libvips42 + libarchive-tools postgresql-client-15 wget wait-for-it graphviz libvips42 # Setup ImageMagick RUN sed -i '/disable ghostscript format types/,+6d' /etc/ImageMagick-6/policy.xml diff --git a/docker/development/docker-compose.yml b/docker/development/docker-compose.yml index be2576c06..851ebafd7 100644 --- a/docker/development/docker-compose.yml +++ b/docker/development/docker-compose.yml @@ -21,7 +21,7 @@ services: - "precreate-core development /solrconfig; precreate-core test /solrconfig; exec solr -f" db: - image: postgres:13 + image: postgres:15-bookworm environment: - POSTGRES_USER=localroot - POSTGRES_HOST_AUTH_METHOD=trust diff --git a/docker/test/docker-compose.yml b/docker/test/docker-compose.yml index 524fc9478..eac37e6e9 100644 --- a/docker/test/docker-compose.yml +++ b/docker/test/docker-compose.yml @@ -12,7 +12,7 @@ services: command: ["solr-precreate", "test", "/solrconfig"] db: - image: postgres:13 + image: postgres:15-bookworm environment: - POSTGRES_USER=localroot - POSTGRES_HOST_AUTH_METHOD=trust From 799211481af25b55d3907c18492e1ab83f4dd2b3 Mon Sep 17 00:00:00 2001 From: Splines Date: Fri, 2 May 2025 21:18:54 +0200 Subject: [PATCH 23/32] Fix rubocop yml file path --- bin/rubocop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/rubocop b/bin/rubocop index 40330c0ff..f186ec214 100755 --- a/bin/rubocop +++ b/bin/rubocop @@ -3,6 +3,6 @@ require "rubygems" require "bundler/setup" # explicit rubocop config increases performance slightly while avoiding config confusion. -ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__)) +ARGV.unshift("--config", File.expand_path("../.config/.rubocop.yml", __dir__)) load Gem.bin_path("rubocop", "rubocop") From 3d293ab56914db3e5f941d09b3bd369600df81a4 Mon Sep 17 00:00:00 2001 From: Splines Date: Fri, 2 May 2025 21:43:18 +0200 Subject: [PATCH 24/32] Fix failing unit tests (don't set queue_adapter to sidekiq) --- config/initializers/active_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/active_job.rb b/config/initializers/active_job.rb index ce7759ede..2184579f9 100644 --- a/config/initializers/active_job.rb +++ b/config/initializers/active_job.rb @@ -1 +1 @@ -Rails.application.config.active_job.queue_adapter = :sidekiq +Rails.application.config.active_job.queue_adapter = :sidekiq unless Rails.env.test? From c4e21e96e6f031104eb4d7b3405a185497b67b72 Mon Sep 17 00:00:00 2001 From: Splines Date: Fri, 2 May 2025 23:55:13 +0200 Subject: [PATCH 25/32] Temporarily uninstall new gems csv & mutex_m --- Gemfile | 4 ++-- Gemfile.lock | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 8bcdeb279..1b64bbcdf 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem "clipboard-rails", "~> 1.7" gem "coffee-rails", "~> 5.0" # CoffeeScript for .coffee assets and views gem "commontator", "~> 7.0.1" gem "coveralls", "~> 0.7", require: false -gem "csv", "~> 3.3" # silence warning: no longer part of default gems for Ruby >=3.4.0 +# gem "csv", "~> 3.3" # silence warning: no longer part of default gems for Ruby >=3.4.0 gem "dalli", "~> 3.2" # caching to memcached in production gem "devise", "~> 4.9" gem "devise-bootstrap-views", "~> 1.1" @@ -75,7 +75,7 @@ gem "webpacker", "~> 5.4" group :development, :docker_development do gem "listen", "~> 3.9" gem "marcel", "~> 1.0" - gem "mutex_m", "~> 0.3" # silence warning: no longer part of default gems for Ruby >=3.4.0 + # gem "mutex_m", "~> 0.3" # silence warning: no longer part of default gems for Ruby >=3.4.0 gem "pgreset", "~> 0.4" gem "rails-erd", "~> 1.7" gem "rubocop", "~> 1.65", require: false diff --git a/Gemfile.lock b/Gemfile.lock index 3c8866e51..352fc7f51 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -188,7 +188,6 @@ GEM crass (1.0.6) css_parser (1.21.1) addressable - csv (3.3.2) dalli (3.2.8) database_cleaner-active_record (2.2.0) activerecord (>= 5.a) @@ -358,7 +357,6 @@ GEM multi_json (1.15.0) multipart-post (2.4.1) mustache (1.1.1) - mutex_m (0.3.0) net-imap (0.5.6) date net-protocol @@ -713,7 +711,6 @@ DEPENDENCIES coffee-rails (~> 5.0) commontator (~> 7.0.1) coveralls (~> 0.7) - csv (~> 3.3) dalli (~> 3.2) database_cleaner-active_record (~> 2.2) devise (~> 4.9) @@ -738,7 +735,6 @@ DEPENDENCIES marcel (~> 1.0) mini_magick (~> 4.13) mobility (~> 1.2) - mutex_m (~> 0.3) net-smtp (~> 0.5) pdf-reader (~> 2.12) pg (~> 1.5) From a12a1caf04e38fc1800ef1399961d18eeb3eb575 Mon Sep 17 00:00:00 2001 From: Splines Date: Sat, 3 May 2025 00:01:23 +0200 Subject: [PATCH 26/32] Instead of adding mutex_m as dependency, update spring See release 4.1.2 of spring where they drop dependency on mutex_m. Therefore, our problem is elegantly solved without the need for a new dependency. https://github.com/rails/spring/blob/main/CHANGELOG.md#412 --- Gemfile | 3 +-- Gemfile.lock | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 1b64bbcdf..2e5a1f120 100644 --- a/Gemfile +++ b/Gemfile @@ -75,13 +75,12 @@ gem "webpacker", "~> 5.4" group :development, :docker_development do gem "listen", "~> 3.9" gem "marcel", "~> 1.0" - # gem "mutex_m", "~> 0.3" # silence warning: no longer part of default gems for Ruby >=3.4.0 gem "pgreset", "~> 0.4" gem "rails-erd", "~> 1.7" gem "rubocop", "~> 1.65", require: false gem "rubocop-performance", "~> 1.21", require: false gem "rubocop-rails", "~> 2.24", require: false - gem "spring", "~> 2.1" # app preloader, keeps app running in background for development + gem "spring", "~> 4.3" # app preloader, keeps app running in background for development gem "spring-watcher-listen", "~> 2.0" gem "web-console", "~> 4.2" # interactive console on exception pages end diff --git a/Gemfile.lock b/Gemfile.lock index 352fc7f51..d2c77c53c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -608,10 +608,10 @@ GEM simplecov (~> 0.19) simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) - spring (2.1.1) - spring-watcher-listen (2.0.1) + spring (4.3.0) + spring-watcher-listen (2.1.0) listen (>= 2.7, < 4.0) - spring (>= 1.2, < 3.0) + spring (>= 4) sprockets (4.2.2) concurrent-ruby (~> 1.0) logger @@ -762,7 +762,7 @@ DEPENDENCIES sidekiq-cron (~> 1.12) simplecov (~> 0.22) simplecov-cobertura (~> 2.1) - spring (~> 2.1) + spring (~> 4.3) spring-watcher-listen (~> 2.0) sprockets-rails (~> 3.5) streamio-ffmpeg (~> 3.0) From d796bda7de6e765633227b4e9f55aa80d5b10bae Mon Sep 17 00:00:00 2001 From: Splines Date: Sat, 3 May 2025 00:05:35 +0200 Subject: [PATCH 27/32] Add back in csv dependency for Vignettes::CsvHandler --- Gemfile | 2 +- Gemfile.lock | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 2e5a1f120..3b6c4f12f 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem "clipboard-rails", "~> 1.7" gem "coffee-rails", "~> 5.0" # CoffeeScript for .coffee assets and views gem "commontator", "~> 7.0.1" gem "coveralls", "~> 0.7", require: false -# gem "csv", "~> 3.3" # silence warning: no longer part of default gems for Ruby >=3.4.0 +gem "csv", "~> 3.3" # for example used in Vignettes::CsvHandler gem "dalli", "~> 3.2" # caching to memcached in production gem "devise", "~> 4.9" gem "devise-bootstrap-views", "~> 1.1" diff --git a/Gemfile.lock b/Gemfile.lock index d2c77c53c..90d9cb3d8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -188,6 +188,7 @@ GEM crass (1.0.6) css_parser (1.21.1) addressable + csv (3.3.4) dalli (3.2.8) database_cleaner-active_record (2.2.0) activerecord (>= 5.a) @@ -711,6 +712,7 @@ DEPENDENCIES coffee-rails (~> 5.0) commontator (~> 7.0.1) coveralls (~> 0.7) + csv (~> 3.3) dalli (~> 3.2) database_cleaner-active_record (~> 2.2) devise (~> 4.9) From 2963988fa66a2021648ff174daf1da0693a8ec25 Mon Sep 17 00:00:00 2001 From: Splines Date: Sat, 3 May 2025 11:56:11 +0200 Subject: [PATCH 28/32] Specify missing config CLI arg for RuboCop in GitHub Actions --- .github/workflows/linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index e256c99af..41dd831b4 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -34,7 +34,7 @@ jobs: if: ${{ steps.rb-changed.outputs.changed-files != ''}} run: | echo "🚨 Running RuboCop version: $(bundle info rubocop | head -1)" - bundle exec rubocop --format github --fail-level 'convention' --force-exclusion -- $CHANGED_FILES + bundle exec rubocop --config ./.config/.rubocop.yml --format github --fail-level 'convention' --force-exclusion -- $CHANGED_FILES eslint: name: ESLint (JS) From ffa5deb1802f6af365ea96a637477856a8b2f7fc Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Mon, 5 May 2025 11:33:00 +0200 Subject: [PATCH 29/32] Reset threads_count to value used previously --- config/puma.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/puma.rb b/config/puma.rb index 03c166f4c..cd36a72dd 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -20,7 +20,7 @@ # Any libraries that use a connection pool or another resource pool should # be configured to provide at least as many connections as the number of # threads. This includes Active Record's `pool` parameter in `database.yml`. -threads_count = ENV.fetch("RAILS_MAX_THREADS", 3) +threads_count = ENV.fetch("RAILS_MAX_THREADS", 5) threads threads_count, threads_count # Specifies the `port` that Puma will listen on to receive requests; default is 3000. From 50c8e6dcf3e18c16b0b80a7f5b85c0b3237ce3ec Mon Sep 17 00:00:00 2001 From: fosterfarrell9 <28628554+fosterfarrell9@users.noreply.github.com> Date: Mon, 5 May 2025 11:37:37 +0200 Subject: [PATCH 30/32] Uncomment require_master_key option --- config/environments/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 1d1f35028..238b538c0 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -17,7 +17,7 @@ # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], # config/master.key, or an environment key such as config/credentials/production.key. # This key is used to decrypt credentials (and other encrypted files). - # config.require_master_key = true + config.require_master_key = true # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead. config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? From 22a334e033f5960f51833e2d10215dde70dfa8ea Mon Sep 17 00:00:00 2001 From: Splines Date: Mon, 5 May 2025 13:39:38 +0200 Subject: [PATCH 31/32] Revert "Reset threads_count to value used previously" This reverts commit ffa5deb1802f6af365ea96a637477856a8b2f7fc. --- config/puma.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/puma.rb b/config/puma.rb index cd36a72dd..03c166f4c 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -20,7 +20,7 @@ # Any libraries that use a connection pool or another resource pool should # be configured to provide at least as many connections as the number of # threads. This includes Active Record's `pool` parameter in `database.yml`. -threads_count = ENV.fetch("RAILS_MAX_THREADS", 5) +threads_count = ENV.fetch("RAILS_MAX_THREADS", 3) threads threads_count, threads_count # Specifies the `port` that Puma will listen on to receive requests; default is 3000. From 4e1e4571fd8e8d5eeab477af50de7479fad2c52e Mon Sep 17 00:00:00 2001 From: Splines Date: Mon, 5 May 2025 13:43:07 +0200 Subject: [PATCH 32/32] Don't require csv gem by default --- Gemfile | 2 +- app/models/interaction.rb | 2 ++ app/models/probe.rb | 2 ++ app/models/tutorial.rb | 3 ++- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 3b6c4f12f..99f71b3b3 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem "clipboard-rails", "~> 1.7" gem "coffee-rails", "~> 5.0" # CoffeeScript for .coffee assets and views gem "commontator", "~> 7.0.1" gem "coveralls", "~> 0.7", require: false -gem "csv", "~> 3.3" # for example used in Vignettes::CsvHandler +gem "csv", "~> 3.3", require: false gem "dalli", "~> 3.2" # caching to memcached in production gem "devise", "~> 4.9" gem "devise-bootstrap-views", "~> 1.1" diff --git a/app/models/interaction.rb b/app/models/interaction.rb index 8e9847305..84438bc0a 100644 --- a/app/models/interaction.rb +++ b/app/models/interaction.rb @@ -1,3 +1,5 @@ +require "csv" + class Interaction < InteractionsRecord scope :created_between, lambda { |start_date, end_date| where(created_at: start_date.beginning_of_day..end_date.end_of_day) diff --git a/app/models/probe.rb b/app/models/probe.rb index 83cacd148..6f730632a 100644 --- a/app/models/probe.rb +++ b/app/models/probe.rb @@ -1,3 +1,5 @@ +require "csv" + class Probe < InteractionsRecord scope :created_between, lambda { |start_date, end_date| where(created_at: start_date.beginning_of_day..end_date.end_of_day) diff --git a/app/models/tutorial.rb b/app/models/tutorial.rb index 31f281d4f..bbce6b341 100644 --- a/app/models/tutorial.rb +++ b/app/models/tutorial.rb @@ -1,4 +1,5 @@ -# Tutorial model +require "csv" + class Tutorial < ApplicationRecord belongs_to :lecture, touch: true