This post originated from an RSS feed registered with Ruby Buzz
by Eric Hodel.
Original Post: Gem Platform Matching
Feed Title: Segment7
Feed URL: http://blog.segment7.net/articles.rss
Feed Description: Posts about and around Ruby, MetaRuby, ruby2c, ZenTest and work at The Robot Co-op.
RubyGems now figures out if your platform matches they gem you want to install, and here’s how it does it.
First, the platform is compared to the list of legacy platforms. These are the platform strings that currently exist in the gems.rubyforge.org index. If the platform matches one of these it is expanded into an Array of CPU, OS and OS version. (New platforms are already an Array.)
Next the platform is compared with your RubyGems configured platforms (“ruby” and your OS platform by default) to see if any match. A platform’s CPU will match if it matches the local platform’s CPU exactly or if either side is ‘universal’. The OS must match exactly. Either OS version can be nil, or it must match exactly.
A potential improvement to the platform matching would be to upgrade a platform to a real object from an Array and make the OS version a Gem::Version and encode in each OS’ versioning scheme. I don’t think there is much benefit to that at present since most gems with platforms are for win32 which doesn’t have versions in Config::CONFIG[‘arch’].