This PR includes some long-overdue deferred maintenance to keep COVE up to date.
Testing
Steve gave this a general regression test on Thursday, but there are still some features to test on our end:
[x] document imports
[x] does the new version of the AWS SDK work?
[x] does COVE successfully parse Word documents and PDFs?
[x] SAML authentication - I want to set up a mock SAML server somewhere and have Steve test with this on Tuesday
[x] ActiveAdmin functionality
[x] can we create, destroy, and update tenants?
[x] are we 100% sure that all data is correctly siloed to the correct tenant?
Upgrades
Ruby from 2.4 to 3.1
Rails from 4.2 to 6.1
Nearly every gem has been upgraded to support the new versions of Ruby and Rails. There's potential for bugs everywhere!
I avoided upgrading gems wherever possible, but "wherever possible" ended up being almost nowhere. Please review the diff to see how the Gemfile changed. Keep in mind that Gemfile.lock will be difficult to compare because the newer version of bundler updated it to a new format.
Removals
removed a ton of old development/testing dependencies
adds a will_paginate initializer to fix a compatibility issue with Active Admin
updates a bunch of method names from various gems to account for upgrade-related renames/removals
for example, before_filter is now before_action
Apartment::Tenant.current_tenant is now just Apartment::Tenant.current
moves the top-level scripts in /lib to /app/lib due to a change in how Rails 5 loads scripts
removes a Postgres monkeypatch that was breaking newer versions of the pg gem (it had been copy/pasted from https://stackoverflow.com/a/59331868). It seemed to have been related to using an ancient version of Rails with a relatively new version of Postgres - it shouldn't be necessary now.
adds a monkeypatch for the URI.escape method - it was removed in Ruby 3 and I couldn't figure out where the call was coming from so the monkeypatch was simpler.
switches the JS compressor from uglifier to terser. Honestly I'm writing this line some time after the fact, but I think there was a Rails compatibility issue with uglifier. terser also supports ES6 so in theory may provide smaller bundle sizes, but I haven't checked that.
adds new auto-generated migrations from the acts-as-taggable-on upgrades
Notes
The previous versions of Ruby and Nokogiri did not have native Apple Silicon versions, so setting up a local build was a big headache for people with newer Macs. These newer versions of Ruby and Nokogiri have proper Apple Silicon support, so you should be able to set up with bundle install like a normal project, with no weird C header errors to contend with.
Apartment::Tenant.switch
The Apartment::Tenant.switch method from the apartment gem now requires a do block and will crash otherwise. To get the old behavior, use Apartment::Tenant.switch! with the exclamation point.
Future work
Just some "nice to have" items and things that might block future upgrades.
The paperclip gem is deprecated in favor of Rails's built-in ActiveStorage. Eventually we'll need to move on from it, as it fails to support newer versions of Rails/Ruby. See https://github.com/thoughtbot/paperclip#deprecated for a migration guide.
CoffeeScript? Really?
there seems to only be one coffeescript file, richText-annotator.js.coffee, which is pretty small. Porting this to JS would allow us to remove the ancient CoffeeScript dependencies that will probably never be updated again.
The JS uses a lot of JQuery and JQueryUI. It's not realistic to remove it, but maybe there's a more lightweight way to include JQuery without using a gem
This repo contains two internal gems in the vendor directory, repertoire-groups and melcatalog. So far they haven't given any trouble on upgrades, but I have to imagine that they will eventually need to be updated for newer versions of Ruby/Rails. For example, repertoire-groups specifies 'rails', '>= 3.0.5' in its Gemfile.
Summary
This PR includes some long-overdue deferred maintenance to keep COVE up to date.
Testing
Steve gave this a general regression test on Thursday, but there are still some features to test on our end:
Upgrades
Nearly every gem has been upgraded to support the new versions of Ruby and Rails. There's potential for bugs everywhere!
I avoided upgrading gems wherever possible, but "wherever possible" ended up being almost nowhere. Please review the diff to see how the Gemfile changed. Keep in mind that
Gemfile.lock
will be difficult to compare because the newer version of bundler updated it to a new format.Removals
Changes
bigdecimal
version in the Gemfile (addresses a crash related to the newer Ruby version, see https://github.com/ruby/bigdecimal#which-version-should-you-select)configure_permitted_parameters
devise
method (see https://github.com/RailsApps/rails-devise-pundit/issues/33)will_paginate
initializer to fix a compatibility issue with Active Adminbefore_filter
is nowbefore_action
Apartment::Tenant.current_tenant
is now justApartment::Tenant.current
/lib
to/app/lib
due to a change in how Rails 5 loads scriptspg
gem (it had been copy/pasted from https://stackoverflow.com/a/59331868). It seemed to have been related to using an ancient version of Rails with a relatively new version of Postgres - it shouldn't be necessary now.URI.escape
method - it was removed in Ruby 3 and I couldn't figure out where the call was coming from so the monkeypatch was simpler.uglifier
toterser
. Honestly I'm writing this line some time after the fact, but I think there was a Rails compatibility issue withuglifier
.terser
also supports ES6 so in theory may provide smaller bundle sizes, but I haven't checked that.acts-as-taggable-on
upgradesNotes
The previous versions of Ruby and Nokogiri did not have native Apple Silicon versions, so setting up a local build was a big headache for people with newer Macs. These newer versions of Ruby and Nokogiri have proper Apple Silicon support, so you should be able to set up with
bundle install
like a normal project, with no weird C header errors to contend with.Apartment::Tenant.switch
The
Apartment::Tenant.switch
method from theapartment
gem now requires ado
block and will crash otherwise. To get the old behavior, useApartment::Tenant.switch!
with the exclamation point.Future work
Just some "nice to have" items and things that might block future upgrades.
paperclip
gem is deprecated in favor of Rails's built-in ActiveStorage. Eventually we'll need to move on from it, as it fails to support newer versions of Rails/Ruby. See https://github.com/thoughtbot/paperclip#deprecated for a migration guide.richText-annotator.js.coffee
, which is pretty small. Porting this to JS would allow us to remove the ancient CoffeeScript dependencies that will probably never be updated again.vendor
directory,repertoire-groups
andmelcatalog
. So far they haven't given any trouble on upgrades, but I have to imagine that they will eventually need to be updated for newer versions of Ruby/Rails. For example,repertoire-groups
specifies'rails', '>= 3.0.5'
in its Gemfile.