Rails/Rack version issue

René van den Berg r.van.den.berg at ogd.nl
Wed Feb 24 00:13:55 UTC 2010


Hi everyone,

First time I'm posting to this list, so here's hoping I'm not saying
anything stupid and this post can be of some actual use to someone.

It seems like the ~> is some special syntax that was developed especially
for rubygems (can be seen at
http://rubygems.rubyforge.org/svn/trunk/lib/rubygems/requirement.rb ). It
implies, quote-unquote:

lambda { |v, r| v = v.release; v >= r && v < r.bump }

where both v and r are Gem::Version objects (the required version and the
version present on the system, respectively). What seems to be happening is
that v (which is "1.1.0") does not satisfy a requirement of "~> r" (where r
= "1.0.1"). I don't have the correct stack available here (my outdated
version of rubygems doesn't seem to support the "release" method), but after
playing around in irb (use 'require "rubygems"' if you want to reproduce)
for a bit, what I think happens here is this:

   - v = v.release (=> v is now "1.1.0", since this was not a prerelease,
   this returns itself)
   - therefore, "v >= r" is the same as "1.1.0 >= 1.0.1" (this would be
   likely to succeed)
   - and "v < r.bump" is the same as Gem::Version.new("1.1.0") >=
   Gem::Version.new("1.0.1").bump

Now the last line seems to be where things go haywire. "bump"ing 1.0.1
results in 1.1 and therefore, this line says "1.1.0 < 1.1"

The question then is, why is this gem specced like this? It seems that "~>"
means "some version from the same major.minor range (teeny doesn't matter)
and not higher than that." Altering the gemspec may help but may, of course,
hurt as well. Some information on why the gem has these requirements would
be very useful in determining the approach to this problem.

I hope this information can be useful to someone.

Regards,
Rene van den Berg

On Wed, Feb 24, 2010 at 12:14 AM, Jeroen van Meeuwen <kanarip at kanarip.com>
 wrote:

>
> On Tue, 23 Feb 2010 17:29:56 -0500, Alejandro Perez
> <alejandro.perez.torres at gmail.com> wrote:
> > Jason,
> >
> >     Can you send the listo of gems you have installed. I work ruby apps
> > and rails, but i normally compile my ruby version on Fedora, seems to me
> > that you installation update the rack version and eliminate the old one,
> > so now you do not have rack 1.0.0 and you application is looking for
> > that version or you do not have the gems version specified on the
> > enviroment.rb file of you application. For instance on my machine gem
> > list provide this line rack (1.1.0, 1.0.1) that mean i have installed
> > the two version of rack.
> >
> > hope this help.
> >
>
> If you use "gem install" and "gem update", yes you can have multiple
> versions of one gem. However, when using the Fedora provided RPM packages,
> only one version of the package will be installed, inherently removing the
> old version of the gem.
>
> -- Jeroen
>
> _______________________________________________
> ruby-sig mailing list
> ruby-sig at lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/ruby-sig
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/ruby-sig/attachments/20100224/bf6f5d95/attachment-0001.html 


More information about the ruby-sig mailing list