How do I find out if a particular gem is compatible with a certain Ruby version or not?
I want to upgrade the Ruby version of an application I am working on, But I did n
Looking for the gemspec
file and checking RubyGems.org is a good way to check Ruby compatibility, but as mentioned above, it would be useless if a gem author didn't write a gemspec
file.
If you using a Ruby version management system like RVM or rbenv, making a simple testing script would be a solution. If Ruby version 2.4.1 and 2.5.1 have been installed on your local machine, write a script similar to "Testing With Multiple Ruby And Gem Versions" like:
#!/usr/bin/env bash
set -e
rubies=("ruby-2.4.1" "ruby-2.5.3")
for i in "${rubies[@]}"
do
echo "====================================================="
echo "$i: Start Test"
echo "====================================================="
rvm $i exec bundle
rvm $i exec bundle exec rake test
echo "====================================================="
echo "$i: End Test"
echo "====================================================="
done
RVM will select a Ruby version and run the test for the selected Ruby version.
If a gem doesn't have any unit tests, this test script would be useless, too. But a gem that doesn't have any unit test would not be worth using.
Although, this solution isn't an authentic way of checking for a compatible Ruby version either, it'd be worth using for your testing.