Build a ruby gem and conditionally specify dependencies

On Fri, Jan 20, 2012 at 3:10 PM, Luis L. [email protected]
wrote:

On Jan 20, 7:56 am, “rails.impaired” [email protected] wrote:>

…

If anyone has a solution other than building multiple .gemspec files
for each target OS… I’m all ears!!

Above example has been used in different projects, most of the time by
#dup the gemspec and building it for each platform.

We face a related problem in the Gemfile of a local Rails project (not a
gem).

Currently, the Gemfile contains:

group :test do
…

on Mac os X

gem ‘rb-fsevent’ if RUBY_PLATFORM.include?(“x86_64-darwin”)
gem ‘ruby_gntp’ if RUBY_PLATFORM.include?(“x86_64-darwin”)

on Linux

gem ‘rb-inotify’ unless RUBY_PLATFORM.include?(“x86_64-darwin”)
gem ‘libnotify’ unless RUBY_PLATFORM.include?(“x86_64-darwin”)
end

This works (although it is ugly) for developing on Mac and Linux
systems.

But, we stopped checking in the Gemfile.lock since it changes every time
a developer with a different platform checks in the code.

So, a solution for multi-platform Gemfiles should also solve the
problem for Gemfile.lock.

Or is there a solution that we overlooked?

Thanks,

Peter