Does bundler obey local config for alternative Gemfile

245 views
Skip to first unread message

Vitalii Khustochka

unread,
Aug 23, 2012, 6:22:17 AM8/23/12
to ruby-b...@googlegroups.com
Hi!

I am trying to use different Gemfile in one of my projects. It works via adding `--gemfile=Gemfile.mingw` to every command (that is tiresome) and via setting BUNDLE_GEMFILE env var (that is not an option because it affects all the projects).

So I thought the best way would be to config alternative gemfile name locally:

bundle config --local gemfile Gemfile.mingw

`bundle config` shows this option was saved. But seems that bundle install/update does not obey it, still trying to install gems from default Gemfile.

Tested with ruby 1.9.3, bundler 1.1.5 and 1.2.0.rc2, Win7 (mingw) and Ubuntu.

Also I have not found many mentions of such an issue on the internet so I could be doing something absolutely wrong? Also posted this on http://stackoverflow.com/questions/12088717/having-different-bundler-gemfiles-for-different-platforms-does-bundler-obey-con

Many thanks.

Rory McCann

unread,
Aug 24, 2012, 6:19:42 AM8/24/12
to ruby-b...@googlegroups.com
Hi,

I'm having similar issues, trying to using Bundler on a project across OS X, Linux, and Windows. As far as I can tell, bundle install does not use the gemfile setting:

(cli.rb:177-179)

>> # Can't use Bundler.settings for this because settings needs gemfile.dirname
>> ENV['BUNDLE_GEMFILE'] = File.expand_path(opts[:gemfile]) if opts[:gemfile]

However, I'm not sure that this would be a useful solution anyway, as surely each Gemfile will install to the same Gemfile.lock. Since Gemfile.lock is essentially platform-specific then I can't see how this helps any more than using platform :mingw blocks in one Gemfile. I can't think of a nice way to have Gemfile.lock consistent on different platforms and still work.

Rory

Vitalii Khustochka

unread,
Sep 17, 2012, 10:54:30 AM9/17/12
to ruby-b...@googlegroups.com
Rory,

thank you for you reply. It seems I found the same answer here:  https://github.com/carlhuda/bundler/issues/1315 

 Unfortunately, by the time Bundler loads the config file, it is too late. You need to set the Gemfile usingBUNDLE_GEMFILE=Gemfile.sj bundle install, or using bundle install --gemfile Gemfile.sj. 

As for

 However, I'm not sure that this would be a useful solution anyway, as surely each Gemfile will install to the same Gemfile.lock.  

I just tested, alternative Gemfile creates its own <GEMFILE NAME>.lock file, e.g. Gemfile.mingw installs to Gemfile.mingw.lock
Reply all
Reply to author
Forward
0 new messages