From: Luis Lavena Date: 2011-01-30T02:55:22+09:00 Subject: Re: how to build gem whose dependencies depend of the platform? On Jan 29, 9:55 am, Uwe Kubosch wrote: > On 2011-01-29, at 12:21, Jarmo Pertman wrote: > > >>> I need to build a gem whose dependencies are dependent of the platform > >>> itself. For example when `gem install my_gem` is issued under Windows, > >>> then in gemspec i have to have spec.add_dependency("gemX"), but if the > >>> command is executed under linux then i need to have > >>> spec.add_dependency("gemY"). > > I have solved this by making the gem depend on the "bundler" gem, and then put the gem dependecies into a Gemfile, and run the equivalent of "bundle install" as a post-install script.  This takes care of everything.  The only thing I am missing is that the dependencies are visible when inspecting the gem. > RubyGems post_install is not scripts, perhaps you're using extension compilation to make that happen, which is intrusive to the user. You're also bringing Bundler when the user might not want it into the mix and slowing down the gem loading process. Bundler is awesome for development, but is awful for runtime dependency. You should not be imposing bundler to the user and even less for runtime execution. Also bundler do not handle properly all the platforms, using a different concept of "platform" of what RubyGems understand and is widely known. -- Luis Lavena