Forum: Ruby Avoid upgrading Ruby while installing gem

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
891c4b63b80421f5edd98a97d234fdc4?d=identicon&s=25 Ravi K. (kravi)
on 2017-02-10 06:31
Hi All,

I am Ruby newbie, just started learning it as one of my projects need

We have been installing em-http-request-1.1.1 with Ruby1.9.3 for last
1.5 years, but recently installation of em-http-request-1.1.1 requires

$ env HOME=/root sudo gem install -V em-http-request -v 1.1.1 --no-rdoc
200 OK
200 OK
200 OK
Installing gem public_suffix-2.0.5
ERROR:  Error installing em-http-request:
        public_suffix requires Ruby version >= 2.0.

Seems em-http-request has dependency on public_suffix and trying to get
prerelease version 2.0.5 of it.

My question, how can I avoid upgrading Ruby to 2.0 while installing
em-http-request. Is there a way? Please help.

3a81ced4012650ca2004c9bff7b18202?d=identicon&s=25 Ronald F. (rovf)
on 2017-02-13 18:10
You could install the gem with the --force option, but I would strongly
suggest that you find out the reason, why you now have the version

It is very rare, that someone would add such a version restriction,
without also incrementing the version number. The only reason I could
imagine, is, that the author of the gem found AFTER releasing it, that
there was some problem of running the Gem with Ruby 1.9, and therefore
added the restriction. This would mean that you might have some problem
in your present usage of the gem which you just haven't noticed yet. At
least you should try to contact the developer and ask why he added the
restriction. Maybe the release notes / readme-files also give some hint.
7e17d370dc95b48cd82944a62f1caf76?d=identicon&s=25 Robert H. (shevegen)
on 2017-02-18 22:10
> but recently installation of em-http-request-1.1.1
> requires Ruby2.0.

> My question, how can I avoid upgrading Ruby to 2.0 while
> installing em-http-request. Is there a way?

In principle you can - it depends on the code that is

If you really can not change the ruby version for whatever
reason, I would compare locally what has changed between
these two gems.

If you can make sure that it works on your older ruby,
then you can simply re-build the gem too and get rid
of that dependency (I mean the limitation on the particular
version). My gems all come with the .gemspec so perhaps
em-http-request and the other gems also come with a
.gemspec file.

You can modify the .gemspec files of all the gems
by the way and rebuild them on your own. This is
quite easy to do. The more difficult part would be
to find out what exactly really mandates ruby 2.x.

If it is syntax changes then you may have to go find
all the places on your own where incompatible syntax
is used.
This topic is locked and can not be replied to.