From 8ab1ae795e4567a64e707f136cd78f82eea48090 Mon Sep 17 00:00:00 2001 From: Jeremy Prevost Date: Wed, 3 Aug 2022 12:50:52 -0400 Subject: [PATCH] Update to ruby 3.1.2 Why are these changes being introduced: * Updating to the latest ruby has many benefits, one of which is that it will allow us to upgrade the Heroku-18 stack to the latest Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/ENGX-176 How does this address that need: * Updates ruby version in both files that store it Document any side effects to this change: * Adds `net-smtp` and related gems to the Gemfile list. Once we upgrade to Rails 7.0.1 this should no longer be necessary. https://stackoverflow.com/a/70500221 For context, these gems were previously part of ruby, but were spun into separate gems as part of Ruby 3.1. Rails 7.0.1 resolved this by making those 3 gems dependencies (hence why we'll be able to remove them from explicitly being in our Gemfile when we upgrade). * Address deprecation notice for `File.exists?` changing to `File.exist?` in two tests * Updated one test that required a full match of an error to pass that previously was just checking for the start of a string. --- .ruby-version | 2 +- Gemfile | 5 +++- Gemfile.lock | 27 +++++++++++++++---- .../dspace_publication_results_job_test.rb | 4 ++- test/models/marc_batch_test.rb | 4 +-- 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/.ruby-version b/.ruby-version index 49cdd668..ef538c28 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.6 +3.1.2 diff --git a/Gemfile b/Gemfile index 724514b6..673bac17 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org' -ruby '2.7.6' +ruby '3.1.2' git_source(:github) do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/') @@ -19,6 +19,9 @@ gem 'kaminari' gem 'lograge' gem 'marc' gem 'mitlibraries-theme' +gem 'net-imap', require: false +gem 'net-pop', require: false +gem 'net-smtp', require: false gem 'omniauth-rails_csrf_protection' gem 'omniauth-saml' gem 'paper_trail' diff --git a/Gemfile.lock b/Gemfile.lock index f7a685fd..fb36543c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -148,6 +148,7 @@ GEM railties (>= 4.1.0) responders warden (~> 1.2.3) + digest (3.1.0) docile (1.4.0) dotenv (2.8.1) dotenv-rails (2.8.1) @@ -217,6 +218,20 @@ GEM momentjs-rails (2.29.1.1) railties (>= 3.1) msgpack (1.5.4) + net-imap (0.2.3) + digest + net-protocol + strscan + net-pop (0.1.1) + digest + net-protocol + timeout + net-protocol (0.1.3) + timeout + net-smtp (0.3.1) + digest + net-protocol + timeout nio4r (2.5.8) nokogiri (1.13.8) mini_portile2 (~> 2.8.0) @@ -331,9 +346,6 @@ GEM sentry-ruby (~> 5.4.1) sentry-ruby (5.4.1) concurrent-ruby (~> 1.0, >= 1.0.2) - sentry-ruby-core (5.4.1) - concurrent-ruby - sentry-ruby (= 5.4.1) simple_form (5.1.0) actionpack (>= 5.2) activemodel (>= 5.2) @@ -354,9 +366,11 @@ GEM activesupport (>= 5.2) sprockets (>= 3.0.0) sqlite3 (1.4.4) + strscan (3.0.4) thor (1.2.1) tilt (2.0.10) timecop (0.9.5) + timeout (0.3.0) tzinfo (2.0.5) concurrent-ruby (~> 1.0) uglifier (4.2.0) @@ -406,6 +420,9 @@ DEPENDENCIES marc minitest-reporters mitlibraries-theme + net-imap + net-pop + net-smtp omniauth-rails_csrf_protection omniauth-saml paper_trail @@ -431,7 +448,7 @@ DEPENDENCIES zip_tricks RUBY VERSION - ruby 2.7.6p219 + ruby 3.1.2p20 BUNDLED WITH - 2.1.4 + 2.3.7 diff --git a/test/jobs/dspace_publication_results_job_test.rb b/test/jobs/dspace_publication_results_job_test.rb index 6e1627f7..6a8d55b6 100644 --- a/test/jobs/dspace_publication_results_job_test.rb +++ b/test/jobs/dspace_publication_results_job_test.rb @@ -161,7 +161,9 @@ def teardown "Unknown status small victory; cannot continue (thesis #{@invalid_status_thesis.id})" # invalid data - assert_includes results[:errors], "Error reading from SQS queue: undefined method `split' for nil:NilClass" + assert_includes results[:errors], "Error reading from SQS queue: undefined method `split' for nil:NilClass\n\n"\ + " thesis_id = package_id.split('_').last\n "\ + "^^^^^^" # no thesis assert_includes results[:errors], "Couldn't find Thesis with 'id'=9999999999999" diff --git a/test/models/marc_batch_test.rb b/test/models/marc_batch_test.rb index 8fb6f58b..3637e85c 100644 --- a/test/models/marc_batch_test.rb +++ b/test/models/marc_batch_test.rb @@ -3,7 +3,7 @@ class MarcBatchTest < ActiveSupport::TestCase test 'builds zip file' do zip_file = MarcBatch.new([theses(:one)], 'marc.xml', 'marc.zip').build - assert File.exists?(zip_file) + assert File.exist?(zip_file) end test 'zip file contains only marcxml file' do @@ -19,6 +19,6 @@ class MarcBatchTest < ActiveSupport::TestCase batch = MarcBatch.new([theses(:one)], 'marc.xml', 'marc.zip') zip_file = batch.build marc_tempfile_path = batch.instance_variable_get(:@marc_filename) - assert_not File.exists?(marc_tempfile_path) + assert_not File.exist?(marc_tempfile_path) end end