Using Ruby 2.2:
# ruby -v
ruby 2.2.10p489 (2018-03-28 revision 63023) [aarch64-linux]
Attempt to install sshkit:
# gem install sshkit
...
ERROR: Error installing sshkit:
There are no versions of base64 (>= 0) compatible with your Ruby & RubyGems. Maybe try installing an older version of the gem you're looking for?
base64 requires Ruby version >= 2.4. The current ruby version is 2.2.0.
The problem is that we have added a dependency on the base64 gem in order to support Ruby 3.4+, but the base64 gem is not available on Ruby 2.2 or older.
In our gemspec, we have this line:
|
gem.add_runtime_dependency('base64') if RUBY_VERSION >= "2.4" |
However, this doesn't work as intended. The RUBY_VERSION check is evaluated at gem publishing time, not at runtime. Assuming we publish the gem using a recent version of Ruby (which we do), then the gem will always have the base64 dependency, regardless of the Ruby version being used to install sshkit.
Further explanation about why it is bad to use RUBY_VERSION conditionals: rubocop/ruby-style-guide#763
Therefore, I think there are two potential fixes:
- Remove the
base64 dependency entirely. This will fix installation on old versions of Ruby. However people using Ruby 3.4+ will have a bad experience: they will need to manually install base64 or add it to their Gemfile, otherwise sshkit won't work.
- Update sshkit to officially drop support for Ruby 2.2 and older.
I'm leaning toward dropping support for old versions of Ruby, given the fact that we have not received any bug reports from people using old versions of Ruby regarding this issue.
Edit: the last version of sshkit that seems to successfully install on Ruby 2.2 is sshkit 1.22.0.
Using Ruby 2.2:
Attempt to install sshkit:
The problem is that we have added a dependency on the base64 gem in order to support Ruby 3.4+, but the base64 gem is not available on Ruby 2.2 or older.
In our gemspec, we have this line:
sshkit/sshkit.gemspec
Line 23 in d8acf40
However, this doesn't work as intended. The
RUBY_VERSIONcheck is evaluated at gem publishing time, not at runtime. Assuming we publish the gem using a recent version of Ruby (which we do), then the gem will always have the base64 dependency, regardless of the Ruby version being used to install sshkit.Further explanation about why it is bad to use
RUBY_VERSIONconditionals: rubocop/ruby-style-guide#763Therefore, I think there are two potential fixes:
base64dependency entirely. This will fix installation on old versions of Ruby. However people using Ruby 3.4+ will have a bad experience: they will need to manually installbase64or add it to their Gemfile, otherwise sshkit won't work.I'm leaning toward dropping support for old versions of Ruby, given the fact that we have not received any bug reports from people using old versions of Ruby regarding this issue.
Edit: the last version of sshkit that seems to successfully install on Ruby 2.2 is sshkit 1.22.0.