[Rubyinstaller-devel] Gem compatibility and platform specific dependencies

Luis Lavena luislavena at gmail.com
Fri Apr 25 00:21:02 EDT 2008

On Fri, Apr 25, 2008 at 1:01 AM, Gordon Thiesfeld <gthiesfeld at gmail.com> wrote:
> This may be better asked on the RubyGems list, but I thought I'd try
>  here first.  I'm working on a patch[1] for the github gem[2].  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.

I think is safe to assume Gem.win_platform? is available since you're
implementing that into a project that get's distributed/installed as

The only problem is that win_platform? will be 'true' even for cygwin
implementation, which will render win32/open3 useless and I can smell
that will crash :-P

>  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
>  this:

To our bad, there isn't a way to do that, you can create a
"windows-specific" version and in that gem include the dependencies,
but without a real need to do that, I think workaround in the code
should be used.

>   begin
>     require 'win32 package'
>   rescue LoadError
>     warn "You must 'gem install the win32 package to do this on Windows"
>     exit 1
>   end
>  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.

A good workaround will be poke the ruby-core developers to merge
win32/open3 package in and reduce our code cluttery, but I don't see
that will happen anytime soon :-P

>  Thanks,

Thanks to you Gordon!

BTW: just pushed installer3 into the repository:

Luis Lavena
Multimedia systems
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams

More information about the Rubyinstaller-devel mailing list