Forum: Ruby Avoid upgrading Ruby while installing gem

2b49f09b3f5eb95f33c1bfa9aa67d730?d=identicon&s=25 Ravi Kumar (kravi)
on 2017-02-10 06:31
Hi All,

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

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
Ruby2.0.

$ env HOME=/root sudo gem install -V em-http-request -v 1.1.1 --no-rdoc
--no-ri
GET http://rubygems.org/specs.4.8.gz
200 OK
GET http://rubygems.org/latest_specs.4.8.gz
200 OK
GET http://rubygems.org/prerelease_specs.4.8.gz
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.

Thanks,
Ravi
0fa73332c8e4a3b06ea439fd3f034322?d=identicon&s=25 Ronald Fischer (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
mismatch:

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.
4828d528e2e46f7c8160c336eb332836?d=identicon&s=25 Robert Heiler (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
used.

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.
Dffea549839e7591fb0c85a99d39a401?d=identicon&s=25 Jo Malone (jomalone)
on 2017-03-10 10:02
That’s a good point.
https://sbobetgroup.com/goldenslot
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.