Ok, but this is not best solution also since user:
1) gem install mylib
2) create a script and `require "mylib"`
3) run that script
4) get an error about missing dependency
5) nevertheless of just running gem install, user needs to run gem
install again

It just feels not user friendly way to solve it. Another way would be
to create separate gems of course, but it's not a good way either.

Jarmo Pertman
-----
IT does really matter - http://www.itreallymatters.net



On Jan 27, 12:40=A0am, Luis Lavena <luislav... / gmail.com> wrote:
> On Jan 26, 7:25=A0pm, Jarmo Pertman <jarm... / gmail.com> 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