Skip to content

Commit

Permalink
Merge pull request #6913 from samvera/ruby-3.3_rails-7.2
Browse files Browse the repository at this point in the history
Numerous compatibility changes and upgrades of dependencies to support Ruby 3.3 and Rails 7.2
  • Loading branch information
randalldfloyd authored Jan 29, 2025
2 parents 3c4a4b5 + f9968b2 commit 4c89bde
Show file tree
Hide file tree
Showing 77 changed files with 356 additions and 408 deletions.
24 changes: 12 additions & 12 deletions .dassie/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,21 @@ gem 'devise-guests', '~> 0.8'
# Required because grpc and google-protobuf gem's binaries are not compatible with Alpine Linux.
# To install the package in Alpine: `apk add ruby-grpc`
# The pinned versions should match the version provided by the Alpine packages.
if RUBY_PLATFORM =~ /musl/
path '/usr/lib/ruby/gems/3.2.0' do
gem 'google-protobuf', '~> 3.24.4', force_ruby_platform: true
gem 'grpc', '~> 1.59.3', force_ruby_platform: true
end
end

# Disabled due to dependency mismatches in Alpine packages (grpc 1.62.1 needs protobuf ~> 3.25)
# if RUBY_PLATFORM =~ /musl/
# path '/usr/lib/ruby/gems/3.3.0' do
# gem 'google-protobuf', '~> 3.24.4', force_ruby_platform: true
# gem 'grpc', '~> 1.62.1', force_ruby_platform: true
# end
# end

gemspec name: 'hyrax', path: ENV.fetch('HYRAX_ENGINE_PATH', '..')
gem 'jbuilder', '~> 2.5'
gem 'jquery-rails'
gem 'pg', '~> 1.3'
gem 'puma'
gem 'rails', '~> 6.1', '>= 6.1.7.10'
gem 'rails', '~> 7.2', '< 8.0'
gem 'riiif', '~> 2.1'
gem 'rsolr', '>= 1.0', '< 3'
gem 'sass-rails', '~> 6.0'
Expand All @@ -39,22 +41,20 @@ gem 'turbolinks', '~> 5'
gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript'
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'uglifier', '>= 1.3.0'
gem 'activerecord-nulldb-adapter', git: 'https://github.com/taylorthurlow/nulldb', branch: 'fix/activerecord72-register-adapter'
gem 'hydra-editor', github: 'samvera/hydra-editor', branch: 'revert_and_modernize'

group :development do
gem 'better_errors' # add command line in browser when errors
gem 'binding_of_caller' # deeper stack trace used by better errors

# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end

group :development, :test do
gem 'debug', '>= 1.0.0'
gem 'pry-doc'
gem 'pry-rails'
gem 'pry-rescue'
end
end
5 changes: 0 additions & 5 deletions .dassie/bin/rails
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
5 changes: 0 additions & 5 deletions .dassie/bin/rake
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
require_relative '../config/boot'
require 'rake'
Rake.application.run
17 changes: 0 additions & 17 deletions .dassie/bin/spring

This file was deleted.

2 changes: 1 addition & 1 deletion .dassie/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
config.assets.prefix = '/dev-assets'

# Raises error for missing translations
config.action_view.raise_on_missing_translations = true
config.i18n.raise_on_missing_translations = true

# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
Expand Down
6 changes: 4 additions & 2 deletions .dassie/config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

# Compress JavaScripts and CSS.
config.assets.js_compressor = Uglifier.new(harmony: true)
# config.assets.css_compressor = :sass
config.assets.configure do |env|
env.js_compressor = :uglifier
# env.css_compressor = :sass
end

# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
Expand Down
2 changes: 1 addition & 1 deletion .dassie/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@
config.active_support.deprecation = :stderr

# Raises error for missing translations
config.action_view.raise_on_missing_translations = true
config.i18n.raise_on_missing_translations = true
end
6 changes: 0 additions & 6 deletions .dassie/config/initializers/mini_magick.rb

This file was deleted.

38 changes: 20 additions & 18 deletions .dassie/config/initializers/riiif.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,31 @@
module Hyrax
# Adds file locking to Riiif::File
# @see RiiifFileResolver
class RiiifFile < Riiif::File
include ActiveSupport::Benchmarkable

attr_reader :id
def initialize(input_path, tempfile = nil, id:)
super(input_path, tempfile)
raise(ArgumentError, "must specify id") if id.blank?
@id = id
end
Rails.application.reloader.to_prepare do
class RiiifFile < Riiif::File
include ActiveSupport::Benchmarkable

attr_reader :id
def initialize(input_path, tempfile = nil, id:)
super(input_path, tempfile)
raise(ArgumentError, "must specify id") if id.blank?
@id = id
end

# Wrap extract in a read lock and benchmark it
def extract(transformation, image_info = nil)
Riiif::Image.file_resolver.file_locks[id].with_read_lock do
benchmark "RiiifFile extracted #{path} with #{transformation.to_params}", level: :debug do
super
# Wrap extract in a read lock and benchmark it
def extract(transformation, image_info = nil)
Riiif::Image.file_resolver.file_locks[id].with_read_lock do
benchmark "RiiifFile extracted #{path} with #{transformation.to_params}", level: :debug do
super
end
end
end
end

private
private

def logger
Hyrax.logger
def logger
Hyrax.logger
end
end
end

Expand Down
6 changes: 0 additions & 6 deletions .dassie/config/spring.rb

This file was deleted.

Loading

0 comments on commit 4c89bde

Please sign in to comment.