My company is currently trying to update our porject base to ruby 2.7 to prepare for a further update to ruby 3.x.
All our projects are currently running with ruby 2.5.
A lot of them were easy to update but i have to handle a very old gem that was developed internally a long time ago (and used in another main project) and which is running dry-rb gems on very outdated versions.
I made a very straightforward try with not much hope just upgrading to latest versions and trying to fix the errors occuring when i ran the specs but as expected that didn't work quite well as latest versions required more than just replacing a few calls but a bigger rework.
Here is what the gemspec and gemfile look like:
Gem::Specification.new do |s|
#......
s.add_runtime_dependency 'activesupport', '~> 5.2.4'
s.add_dependency 'dry-configurable', '<0.13'
s.add_dependency 'dry-container', '<0.8'
s.add_dependency 'dry-struct', '~> 0.5.0'
s.add_dependency 'dry-types', '~> 0.13.0'
s.add_dependency 'dry-validation', '~> 0.12.0'
s.add_dependency 'geo_coord', '~> 0.1'
s.add_dependency 'i18n', '~> 1.0'
s.add_dependency 'proj4rb', '~> 3.0'
s.add_dependency 'psych', '~> 3.1'
s.add_dependency 'ruby-netcdf', '~> 0.7'
s.add_runtime_dependency 'thor', '~> 1.0', '~> 1.0.1'
end
source 'https://rubygems.org'
gemspec
gem 'dry-validation'
group :development, :test do
gem 'bundler-audit'
gem 'dry-validation-matchers', '~> 1.1.0'
gem 'hashdiff'
gem 'pry', '~> 0.11'
gem 'railties', '> 0', require: false
gem 'rake', '~> 12.3'
gem 'rspec', '~> 3.7'
gem 'rspec-dry-struct', '~> 0.3.0'
gem 'rspec-prof'
gem 'rubocop', '~> 0.62.0'
gem 'simplecov', '~> 0.16'
gem 'yard', '~> 0.9'
end
I'm kind of lost with this kind of stuff and don't really know where to start. If anybody has any experience with upgrading dry gems, any idea of the first compatible versions of those gems with ruby 2.7 or any procedure i could follow to make the process less painful that would be really appreciated!
Thanks!
First of all check your versions requirements on rubygems docs (as in here dry-configurable). And progress by making each of those dry gems a minor version bumping one-by-one.
Side note: There are a few common rails upgrades strategies used by companies with rails projects. Check how to dual boot with next_rails gem it might help you upgrade during the process, also, some good test coverage and a CI/CD setup would be very helpful through this upgrade process.
Check FastRuby page and click the 'Get the book'. It's a very helpful rails upgrade book.