Hi!
I have developing a gem where some of it’s dependencies are not
in .gemspec since they can be different depending of the value of
environment variable, class variable or just depending of the OS in
use. In short, these dependencies expose the same API, but can be
switched during runtime before actually loading the gem itself. The
gem then does something in the lines of:
require “rubygems”
gem “dependency”, “version”
require “dependency”
depending of some criteria as written above. Now when using Bundler
with it’s Bundler.setup invocation, what should be in Gemfile so it
would work the same on every configuration without having to have
modified Gemfile and Gemfile.lock on each different machine.
Can i have different “gem” lines in Gemfile on different machines and
commit it actually into VCS without having to modify it on each and
every machine separately?
Something in the Gemfile like this would work perfectly?
if RUBY_PLATFORM =~ /mswin|msys|mingw32/
gem “dep1”
else
gem “dep2”
end
In that case “dep1” and “dep2” would end up in Gemfile.lock - is it
okay, even if dep1 is not installable on unix platform?
Jarmo P.