tags:

views:

66

answers:

2

I'm using Ruby 1.9.2 (Yarv).

When I install gems I just use "gem install ".

How can I know which Ruby version they are written in: 1.8.7, 1.9.1 or 1.9.2?

If I'm using the latest version and I install a gem that is written in 1.8.7, then that gem doesn't work?

Eg. Yardstick gem seems to not work with 1.9.2 but perfectly with 1.8.7.

How do you check what version each gem is using?

Could someone enlighten this topic for me.

+1  A: 

Unfortunatelly there is no definitive way to check that as there are so many versions and variants or Ruby interpreters (Ruby, JRuby, Iron Ruby) and system platforms. Also one gem which is pure Ruby may not work on all platforms with same interpereter verson, because some OS specific properties could be used.

So you must trust the autor or docs he/she provided. Another way to make sure that your platform is right for gem just run tests enclosed to gem - every well written gem should have such.

There is also small tip: if file contains

# -*- encoding: utf-8 -*-

then autor probably developed the gem with 1.9.x in mind.

gertas
file may also contain `# encoding: utf-8` string.
SMiX
+2  A: 

There's a website for answering the question: "Is it Ruby 1.9?"

http://isitruby19.com/

It doesn't look like anyone has reported on Yardstick yet: http://isitruby19.com/yardstick

You could be the first, and report that it's broken in 1.9.

Jim Garvin
There was another site for this too. Do you know which one I mean?
never_had_a_name
Are you thinking of rubygems.org, formerly a.k.a. gemcutter.org?
Jim Garvin
railsplugins.org ?
Andrew Grimm
nice idea, but currently not sufficient (no results for some gems I use), I suggest adding exact Ruby version option (1.9.1, 1.9.2 .. and tomorrow 1.9.3) for user comments.
gertas