Skip to content

Commit

Permalink
chore(rails): upgrade to rails 7.2.1
Browse files Browse the repository at this point in the history
- migrated secret_key_base from Rails secrets to (encrypted) credentials
- updated all enum declarations from deprecated keyword args to positional args
- updated gem calculated_attributes to compatible self-maintained fork
- updated third-party gems unread,active_record_upsert to compatible bleeding-edge commits
- mock _default_attributes also for specs mocking load_schema (needed due to internal refactoring in 7.2)
- set eager_load to true in all environments to ensure table_name overrides loaded
- updated carrierwave to v3, amended relevant test case
  • Loading branch information
adi-herwana-nus committed Sep 20, 2024
1 parent 96f3778 commit 069fe1e
Show file tree
Hide file tree
Showing 47 changed files with 205 additions and 156 deletions.
15 changes: 9 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ruby '3.1.4'
gem 'tzinfo-data', platforms: [:mswin, :mswin64]

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 7.1.4'
gem 'rails', '~> 7.2.1'

# Use PostgreSQL for the backend
gem 'pg'
Expand All @@ -18,7 +18,8 @@ gem 'rack-cors'
# Instance/Course settings
gem 'settings_on_rails', git: 'https://github.com/Coursemology/settings_on_rails'
# Manage read/unread status
gem 'unread'
# fix for https://github.com/ledermann/unread/issues/135
gem 'unread', git: 'https://github.com/ledermann/unread', ref: '675b744'
# Extension for validating hostnames and domain names
gem 'validates_hostname'
# A Ruby state machine library
Expand All @@ -29,14 +30,14 @@ gem 'activerecord-userstamp', git: 'https://github.com/Coursemology/activerecord
# Allow actions to be deferred until after a record is committed.
gem 'after_commit_action'
# Allow declaring the calculated attributes of a record
gem 'calculated_attributes', git: 'https://github.com/aha-app/calculated_attributes'
gem 'calculated_attributes', git: 'https://github.com/adi-herwana-nus/calculated_attributes.git'
# For multiple table inheritance
# TODO: Figure out breaking changes in v2 as polymorphism is not working correctly.
gem 'active_record-acts_as', git: 'https://github.com/Coursemology/active_record-acts_as.git'
# Organise ActiveRecord model into a tree structure
gem 'edge'
# Upsert action for Postgres
gem 'active_record_upsert', '0.11.2'
# Upsert action for Postgres with validations
gem 'active_record_upsert', git: 'https://github.com/jesjos/active_record_upsert', ref: 'c3e07ae'
# Create pretty URLs and work with human-friendly strings
gem 'friendly_id'

Expand Down Expand Up @@ -106,6 +107,8 @@ group :development, :test do
gem 'rubocop', '~> 1.66'

# Factory Bot for factories
# fix for https://github.com/thoughtbot/factory_bot/issues/1690
gem 'factory_bot', '~> 6.5.0'
gem 'factory_bot_rails'

# Checks that all translations are used and defined
Expand Down Expand Up @@ -181,7 +184,7 @@ gem 'jwt'
gem 'cancancan'

# Using CarrierWave for file uploads
gem 'carrierwave', '2.2.6'
gem 'carrierwave', '~> 3'
# Generate sequential filenames
gem 'filename'
# Required by CarrierWave, for image resizing
Expand Down
184 changes: 97 additions & 87 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,94 +27,104 @@ GIT
rails (>= 6)

GIT
remote: https://github.com/aha-app/calculated_attributes
revision: d2f69a1acefd5646ce1908fed3785a63d8399374
remote: https://github.com/adi-herwana-nus/calculated_attributes.git
revision: 3d9fe0c99070c61de634b7235044200d61b65a65
specs:
calculated_attributes (1.0.0)
calculated_attributes (1.0.1)
activerecord (>= 6.0.0, < 8)

GIT
remote: https://github.com/jesjos/active_record_upsert
revision: c3e07aecf28d6a81a06fcada4710b103dfca823b
ref: c3e07ae
specs:
active_record_upsert (0.11.2)
activerecord (>= 5.2, < 8.0)
pg (>= 0.18, < 2.0)

GIT
remote: https://github.com/ledermann/unread
revision: 675b7443af5ca23e44ffe3b70a443a5ec1d3952b
ref: 675b744
specs:
unread (0.13.1)
activerecord (>= 6.1)

GEM
remote: https://rubygems.org/
specs:
actioncable (7.1.4)
actionpack (= 7.1.4)
activesupport (= 7.1.4)
actioncable (7.2.1)
actionpack (= 7.2.1)
activesupport (= 7.2.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.4)
actionpack (= 7.1.4)
activejob (= 7.1.4)
activerecord (= 7.1.4)
activestorage (= 7.1.4)
activesupport (= 7.1.4)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.4)
actionpack (= 7.1.4)
actionview (= 7.1.4)
activejob (= 7.1.4)
activesupport (= 7.1.4)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
actionmailbox (7.2.1)
actionpack (= 7.2.1)
activejob (= 7.2.1)
activerecord (= 7.2.1)
activestorage (= 7.2.1)
activesupport (= 7.2.1)
mail (>= 2.8.0)
actionmailer (7.2.1)
actionpack (= 7.2.1)
actionview (= 7.2.1)
activejob (= 7.2.1)
activesupport (= 7.2.1)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (7.1.4)
actionview (= 7.1.4)
activesupport (= 7.1.4)
actionpack (7.2.1)
actionview (= 7.2.1)
activesupport (= 7.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.4)
actionpack (= 7.1.4)
activerecord (= 7.1.4)
activestorage (= 7.1.4)
activesupport (= 7.1.4)
useragent (~> 0.16)
actiontext (7.2.1)
actionpack (= 7.2.1)
activerecord (= 7.2.1)
activestorage (= 7.2.1)
activesupport (= 7.2.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.4)
activesupport (= 7.1.4)
actionview (7.2.1)
activesupport (= 7.2.1)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
active_record_upsert (0.11.2)
activerecord (>= 5.2, < 7.2)
pg (>= 0.18, < 2.0)
activejob (7.1.4)
activesupport (= 7.1.4)
activejob (7.2.1)
activesupport (= 7.2.1)
globalid (>= 0.3.6)
activemodel (7.1.4)
activesupport (= 7.1.4)
activerecord (7.1.4)
activemodel (= 7.1.4)
activesupport (= 7.1.4)
activemodel (7.2.1)
activesupport (= 7.2.1)
activerecord (7.2.1)
activemodel (= 7.2.1)
activesupport (= 7.2.1)
timeout (>= 0.4.0)
activerecord-import (1.8.1)
activerecord (>= 4.2)
activestorage (7.1.4)
actionpack (= 7.1.4)
activejob (= 7.1.4)
activerecord (= 7.1.4)
activesupport (= 7.1.4)
activestorage (7.2.1)
actionpack (= 7.2.1)
activejob (= 7.2.1)
activerecord (= 7.2.1)
activesupport (= 7.2.1)
marcel (~> 1.0)
activesupport (7.1.4)
activesupport (7.2.1)
base64
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
tzinfo (~> 2.0)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
acts_as_tenant (1.0.1)
rails (>= 6.0)
addressable (2.8.7)
Expand Down Expand Up @@ -163,13 +173,12 @@ GEM
capybara-selenium (0.0.6)
capybara
selenium-webdriver
carrierwave (2.2.6)
activemodel (>= 5.0.0)
activesupport (>= 5.0.0)
carrierwave (3.0.7)
activemodel (>= 6.0.0)
activesupport (>= 6.0.0)
addressable (~> 2.6)
image_processing (~> 1.1)
marcel (~> 1.0.0)
mini_mime (>= 0.1.3)
ssrf_filter (~> 1.0)
childprocess (5.0.0)
codecov (0.6.0)
Expand Down Expand Up @@ -211,7 +220,7 @@ GEM
tzinfo
excon (0.111.0)
exifr (1.4.0)
factory_bot (6.4.6)
factory_bot (6.5.0)
activesupport (>= 5.0.0)
factory_bot_rails (6.4.3)
factory_bot (~> 6.4)
Expand Down Expand Up @@ -275,7 +284,7 @@ GEM
image_optim (~> 0.24)
railties
sprockets
image_processing (1.12.2)
image_processing (1.13.0)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
image_size (3.4.0)
Expand Down Expand Up @@ -348,7 +357,6 @@ GEM
mini_portile2 (2.8.7)
minitest (5.25.1)
multi_json (1.15.0)
mutex_m (0.2.0)
net-imap (0.4.14)
date
net-protocol
Expand Down Expand Up @@ -391,20 +399,20 @@ GEM
rackup (1.0.0)
rack (< 3)
webrick
rails (7.1.4)
actioncable (= 7.1.4)
actionmailbox (= 7.1.4)
actionmailer (= 7.1.4)
actionpack (= 7.1.4)
actiontext (= 7.1.4)
actionview (= 7.1.4)
activejob (= 7.1.4)
activemodel (= 7.1.4)
activerecord (= 7.1.4)
activestorage (= 7.1.4)
activesupport (= 7.1.4)
rails (7.2.1)
actioncable (= 7.2.1)
actionmailbox (= 7.2.1)
actionmailer (= 7.2.1)
actionpack (= 7.2.1)
actiontext (= 7.2.1)
actionview (= 7.2.1)
activejob (= 7.2.1)
activemodel (= 7.2.1)
activerecord (= 7.2.1)
activestorage (= 7.2.1)
activesupport (= 7.2.1)
bundler (>= 1.15.0)
railties (= 7.1.4)
railties (= 7.2.1)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -419,10 +427,10 @@ GEM
rails-i18n (7.0.9)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (7.1.4)
actionpack (= 7.1.4)
activesupport (= 7.1.4)
irb
railties (7.2.1)
actionpack (= 7.2.1)
activesupport (= 7.2.1)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
Expand Down Expand Up @@ -489,7 +497,7 @@ GEM
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (6.1.4)
rspec-rails (6.1.5)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
Expand Down Expand Up @@ -521,12 +529,14 @@ GEM
rubocop-ast (>= 1.31.1, < 2.0)
ruby-oembed (0.18.0)
ruby-progressbar (1.13.0)
ruby-vips (2.2.1)
ruby-vips (2.2.2)
ffi (~> 1.12)
logger
rubyzip (2.3.2)
sanitize (6.1.3)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
securerandom (0.3.1)
selenium-webdriver (4.22.0)
base64 (~> 0.2)
logger (~> 1.4)
Expand Down Expand Up @@ -578,8 +588,7 @@ GEM
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
uniform_notifier (1.16.0)
unread (0.13.1)
activerecord (>= 6.1)
useragent (0.16.10)
validates_hostname (1.0.13)
activerecord (>= 3.0)
activesupport (>= 3.0)
Expand All @@ -604,7 +613,7 @@ PLATFORMS

DEPENDENCIES
active_record-acts_as!
active_record_upsert (= 0.11.2)
active_record_upsert!
activerecord-import (>= 0.2.0)
activerecord-userstamp!
acts_as_tenant
Expand All @@ -617,7 +626,7 @@ DEPENDENCIES
capybara
capybara-screenshot
capybara-selenium
carrierwave (= 2.2.6)
carrierwave (~> 3)
codecov
consistency_fail
coursemology-polyglot
Expand All @@ -627,6 +636,7 @@ DEPENDENCIES
dotenv-rails
edge
email_spec
factory_bot (~> 6.5.0)
factory_bot_rails
ffi (>= 1.14.2)
filename
Expand Down Expand Up @@ -655,7 +665,7 @@ DEPENDENCIES
puma
rack-cors
rack-mini-profiler
rails (~> 7.1.4)
rails (~> 7.2.1)
rails-controller-testing
rails-html-sanitizer (>= 1.0.4)
recaptcha
Expand Down Expand Up @@ -686,7 +696,7 @@ DEPENDENCIES
stackprof
traceroute
tzinfo-data
unread
unread!
validates_hostname
workflow
workflow-activerecord (>= 4.1, < 7.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def publish_delayed_posts
update_delayed_topics_and_posts(submission_question_topics)

# Publish delayed annotations for each programming question of a submission
programming_answers = answers.where('actable_type = ?', Course::Assessment::Answer::Programming)
programming_answers = answers.where('actable_type = ?', Course::Assessment::Answer::Programming.name)
annotation_topics = programming_answers.flat_map(&:specific).
flat_map(&:files).flat_map(&:annotations).map(&:discussion_topic)
update_delayed_topics_and_posts(annotation_topics)
Expand Down
Loading

0 comments on commit 069fe1e

Please sign in to comment.