[Rubyinstaller-devel] Gem compatibility and platform specific dependencies
gthiesfeld at gmail.com
Fri Apr 25 00:01:21 EDT 2008
This may be better asked on the RubyGems list, but I thought I'd try
here first. I'm working on a patch for the github gem. The
github command requires open3, which doesn't work on Windows because
of fork, so I have it check for platform, and require WIn32-Open3 if
on Windows. So, I have two questions about how to go about this.
First, is Gem.win_platform? the proper way to go about this. I think
it's safe to say this package will always be distributed as a gem, so
Gem will always exist when I need it.
Second, is there a way to have Gem depedencies that are platform
specific? Open3 is part of the stdlib, so no dependency there, but on
Windows we need the Win32 gem. I've borrowed a pattern from RSpec for
require 'win32 package'
warn "You must 'gem install the win32 package to do this on Windows"
But in the case of RSpec, it's only used for colored console output.
If you don't use that feature, you'll never know you need to have the
gem installed. In this case, the whole thing just won't work.
That's what dependencies are all about, I'd think. If there isn't
such a thing as platform specific dependencies, then what I'm fine
doing it this way. I'm just wondering if there's a better way.
More information about the Rubyinstaller-devel