From 49cda8ab0dbfe861e50f9d17ff4c6089366ea13b Mon Sep 17 00:00:00 2001 From: Adam Ploshay Date: Tue, 3 Aug 2021 09:42:41 -0400 Subject: [PATCH 1/2] WIP ruby 3.0 support --- .ruby-version | 2 +- Gemfile | 3 ++- Gemfile.lock | 2 ++ app/models/bin.rb | 2 +- app/models/digital_file_provenance.rb | 4 ++-- app/models/machine.rb | 2 +- app/models/processing_step.rb | 2 +- app/models/signal_chain.rb | 2 +- app/models/unit.rb | 2 +- app/models/user.rb | 2 +- app/models/workflow_status.rb | 2 +- 11 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.ruby-version b/.ruby-version index a4dd9dba..b5021469 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.4 +3.0.2 diff --git a/Gemfile b/Gemfile index fb279d43..3a2dada0 100644 --- a/Gemfile +++ b/Gemfile @@ -47,6 +47,8 @@ gem 'will_paginate', '~> 3.0' # ruby 2.7 support for activesupport 4.2.x gem 'bigdecimal', '~> 1.4.4' +# ruby 3.0 support +gem 'webrick' # Use jquery as the JavaScript library gem 'jquery-rails' @@ -100,7 +102,6 @@ group :development do end group :test do - gem 'selenium-webdriver' gem 'capybara' #for capybara javascript access gem 'selenium-webdriver' diff --git a/Gemfile.lock b/Gemfile.lock index 97444101..f1f6510e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -359,6 +359,7 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.7.0) will_paginate (3.3.1) xpath (3.2.0) nokogiri (~> 1.8) @@ -404,6 +405,7 @@ DEPENDENCIES uglifier (>= 1.3.0) webdrivers webmock + webrick will_paginate (~> 3.0) BUNDLED WITH diff --git a/app/models/bin.rb b/app/models/bin.rb index b4e339cd..67c6584f 100644 --- a/app/models/bin.rb +++ b/app/models/bin.rb @@ -1,7 +1,7 @@ class Bin < ActiveRecord::Base require 'net/http' - default_scope { order(:identifier) } + default_scope lambda { order(:identifier) } after_initialize :default_values belongs_to :batch diff --git a/app/models/digital_file_provenance.rb b/app/models/digital_file_provenance.rb index 7e702eb7..cd3808a2 100644 --- a/app/models/digital_file_provenance.rb +++ b/app/models/digital_file_provenance.rb @@ -3,7 +3,7 @@ class DigitalFileProvenance < ActiveRecord::Base before_save :nullify_na_values belongs_to :digital_provenance belongs_to :signal_chain - default_scope { order(:id) } + default_scope lambda { order(:filename) } attr_accessor :display_date_digitized validates :digital_provenance, presence: true @@ -22,7 +22,7 @@ class DigitalFileProvenance < ActiveRecord::Base validate :filename_validation validate :validate_signal_chain - default_scope { order(:filename) } + # File Uses: # pres for preservation master diff --git a/app/models/machine.rb b/app/models/machine.rb index 7609a0e2..f98150cc 100644 --- a/app/models/machine.rb +++ b/app/models/machine.rb @@ -1,7 +1,7 @@ class Machine < ActiveRecord::Base validates :category, presence: true validates :serial, presence: true - default_scope { + default_scope lambda { # FIXME: # this order interferes with the processing_steps position order, but I think that removing this # simply results in the order of machines in a device chain being the id order of the machine diff --git a/app/models/processing_step.rb b/app/models/processing_step.rb index 1b142cdb..2fe91357 100644 --- a/app/models/processing_step.rb +++ b/app/models/processing_step.rb @@ -5,7 +5,7 @@ class ProcessingStep < ActiveRecord::Base validates :machine, presence: true validates :position, presence: true, numericality: { greater_than: 0 }, uniqueness: { scope: :signal_chain } validate :validate_format_compatibility - default_scope { order(:signal_chain_id, :position) } + default_scope lambda { order(:signal_chain_id, :position) } def validate_format_compatibility if signal_chain && machine diff --git a/app/models/signal_chain.rb b/app/models/signal_chain.rb index 0e3129ab..1c411468 100644 --- a/app/models/signal_chain.rb +++ b/app/models/signal_chain.rb @@ -1,6 +1,6 @@ class SignalChain < ActiveRecord::Base validates :name, presence: true, uniqueness: true - default_scope { order(:name) } + default_scope lambda { order(:name) } has_many :processing_steps, dependent: :destroy has_many :machines, through: :processing_steps has_many :signal_chain_formats, dependent: :destroy diff --git a/app/models/unit.rb b/app/models/unit.rb index 3281c49e..0b6c35b3 100644 --- a/app/models/unit.rb +++ b/app/models/unit.rb @@ -1,5 +1,5 @@ class Unit < ActiveRecord::Base - default_scope { order(:abbreviation) } + default_scope lambda { order(:abbreviation) } validates :abbreviation, presence: true, uniqueness: true validates :name, presence: true, uniqueness: { scope: [:institution, :campus] } diff --git a/app/models/user.rb b/app/models/user.rb index 81e4d13f..6d660a1f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -5,7 +5,7 @@ class User < ActiveRecord::Base belongs_to :unit - default_scope { order(:name) } + default_scope lambda { order(:name) } def self.authenticate(username) return false if username.nil? || username.blank? diff --git a/app/models/workflow_status.rb b/app/models/workflow_status.rb index c2133fc0..bec671a3 100644 --- a/app/models/workflow_status.rb +++ b/app/models/workflow_status.rb @@ -3,7 +3,7 @@ class WorkflowStatus < ActiveRecord::Base XML_EXCLUDE = [:workflow_status_template_id, :physical_object_id, :bin_id, :batch_id, :notes] include XMLExportModule - default_scope { order(:id) } + default_scope lambda { order(:id) } belongs_to :workflow_status_template belongs_to :physical_object From fba67335ac601f5f8fc95e4fcf83765a37c144ec Mon Sep 17 00:00:00 2001 From: Adam Ploshay Date: Tue, 14 Dec 2021 10:26:58 -0500 Subject: [PATCH 2/2] conservative bundle update --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index f1f6510e..51565d82 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -205,7 +205,7 @@ GEM listen (3.7.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.12.0) + loofah (2.13.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.2.8) @@ -325,7 +325,7 @@ GEM json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - spring (3.1.1) + spring (4.0.0) spring-commands-rspec (1.0.4) spring (>= 0.9.1) sprockets (2.12.5)