From: Kane Williams Date: 2011-06-18T20:12:38+09:00 Subject: Re: how would you set dynamically determined dependencies with or without bundler? --_e2eec1d0-513d-45cc-af91-c54bbeb3572c_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable unsubscribe > Date: Sat=2C 18 Jun 2011 18:45:32 +0900 > From: jarmo.p@gmail.com > Subject: Re: how would you set dynamically determined dependencies with o= r without bundler? > To: ruby-talk@ruby-lang.org >=20 > After playing around a little i found this solution to be the one i > needed - in Gemfile: >=20 > platforms :mswin=2C :mingw do > gem "win-specific-gem1" > gem "win-specific-gem2" > end >=20 > gem "gem3" # works on all platforms >=20 > Now in my gem i just do require "win-specific-gemX" if the OS is win > and on other's require "gem3". If there's any better solution then let > me know of course :) >=20 > Jarmo Pertman > ----- > IT does really matter - http://www.itreallymatters.net >=20 > On Jun 18=2C 10:21 am=2C Jarmo Pertman wrote: > > 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=2C class variable or just depending of the OS in > > use. In short=2C these dependencies expose the same API=2C 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"=2C "version" > > require "dependency" > > > > depending of some criteria as written above. Now when using Bundler > > with it's Bundler.setup invocation=2C 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 =3D~ /mswin|msys|mingw32/ > > gem "dep1" > > else > > gem "dep2" > > end > > > > In that case "dep1" and "dep2" would end up in Gemfile.lock - is it > > okay=2C even if dep1 is not installable on unix platform? > > > > Jarmo Pertman > > ----- > > IT does really matter -http://www.itreallymatters.net >=20 >=20 = --_e2eec1d0-513d-45cc-af91-c54bbeb3572c_--