Make bundler use different gems for different platforms

后端 未结 9 1439
甜味超标
甜味超标 2020-11-29 02:06

I\'m working on upgrading one of our Rails 2.3.8 apps to Rails 3, and have run into an annoying problem with bundler and deployment. I develop the application on a Windows m

9条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-29 02:18

    Our engineers at Engine Yard have submitted a patch to Bundler to address this issue and unfreeze the gems if on a different platform. We've been having the same problem with many Windows trying to deploy after running through the RailsInstaller Demo Tutorial. The best fix we've found is to perform the following:

    1. bundle install like normal on your development machine
    2. Go through the Gemfile.lock and if there are any lines with -x86-mingw32, remove that part.
      • bcrypt-ruby (3.0.1-x86-mingw32) becomes bcrypt-ruby (3.0.1)
    3. Add ruby under the 'Platforms' section in the Gemfile.lock
    4. Make sure to explicitly specify the needed gem in the Gemfile with the platform flag. (Not sure if this is needed but it doesn't hurt)
      • In Gemfile: `gem 'bcrypt-ruby', '~> 3.0', :platform => 'ruby'
    5. bundle install again which will keep the bcrypt-ruby (3.0.1) line and add in bcrypt-ruby (3.0.1-x86-mingw32) again.

    If you're curious about the Bundler patch, you can get notifications at https://github.com/carlhuda/bundler/pull/1451

    Hope this helps anyone still looking for answers.

提交回复
热议问题