Last active
July 6, 2024 14:09
-
-
Save scpike/680ceb29a9bdff4eafb123986782c5c1 to your computer and use it in GitHub Desktop.
Check for silent gem incompatibilities in Rails 7.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Run like `ruby incompat_71.rb ~/path/to/Gemfile.lock` | |
# From the team at infield.ai | |
# | |
PACKAGES = [['activerecord-import', '1.5.0'], | |
['anycable-rails', '1.4.1'], | |
['blazer', '3.0.1'], | |
['bullet', '7.1.2'], | |
['data_migrate', '9.2.0'], | |
['database_cleaner-active_record', '2.1.0'], | |
['devise', '4.9.3'], | |
['formtastic', '5.0.0'], | |
['grape', '2.0.0'], | |
['has_scope', '0.8.2'], | |
['honeybadger', '5.1.0'], | |
['lockbox', '1.3.1'], | |
['paper_trail', '15.1.0'], | |
['public_activity', '3.0.0'], | |
['ransack', '4.1.0'], | |
['responders', '3.1.1'], | |
['rollbar', '3.4.1'], | |
['rspec-rails', '6.1.0'], | |
['rubocop-rails', '2.22.2'], | |
['shoulda-matchers', '6.0.0'], | |
['sidekiq', '7.1.5'], | |
['simple_form', '5.3.0'], | |
['slim', '5.2.0'], | |
['web-console', '4.2.1']].map { |(name, ver)| [name, Gem::Version.new(ver)] }.to_h | |
require 'bundler' | |
Bundler::LockfileParser.new(ARGF.read).specs.each do |spec| | |
name = spec.name | |
next unless required_version = PACKAGES[name] | |
if required_version > spec.version | |
puts "#{name}: Using #{spec.version}. Upgrade to #{required_version}" | |
end | |
end |
Yeah that's a bit of bummer with these run time dependencies.
I realized that the redis cache store also requires 4+:
https://github.com/rails/rails/blob/0d30e84878223df68efda3b0e1741611d9682a45/activesupport/lib/active_support/cache/redis_cache_store.rb#L4
So maybe it is safe to say if you use redis to have at least version 4? I don't think it's a breaking change from 3.x and has been released in 2017: https://redis.io/blog/redis-4-0-0-released/.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@djfpaagman thanks! We've actually made this into a real project at https://github.com/infieldai/gemcompat/blob/main/data/rails/7_1.yaml. I think in order to handle this case we'd need to be able to model the [action cable <-> redis] requirement. If I just add it to our DB for rails then there will be false positives for people not using action cable.