From: Luis Lavena Date: 2011-01-27T07:45:22+09:00 Subject: Re: how to build gem whose dependencies depend of the platform? On Jan 26, 7:25 pm, Jarmo Pertman wrote: > Hi! > > 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"). > > Is there any easy way to do this or should i just do it like this > instead: > 1) remove all platform specific dependencies from gemspec > 2) when loading the gem, then use RUBY_PLATFORM to decide what gems to > load and rescue Gem::LoadError to print out friendly messages like > "please install gemX" This one is the best approach. Have that clearly in the documentation and the error you present to the user is the best option. The other will be generate one gem for every platform and indicate there the dependencies. Lot of work for you :-P -- Luis Lavena