Gemfile.lock different platforms?

55 views
Skip to first unread message

Ed Sumerfield

unread,
Nov 9, 2014, 5:49:23 PM11/9/14
to Cincinnati Ruby Brigade
I am using pry for a product on mac and windows and it is dependent on win32console on the windows platform only. How can I manage the Gemfile.lock in source control if it changes every time I switch platforms?

I can prevent the problem at bundle install time with this, but it still changes the lock file.

  if RUBY_PLATFORM =~ /mingw32/
    gem 'win32console', '1.3.2'
  end

Greg Mefford

unread,
Nov 9, 2014, 6:29:03 PM11/9/14
to cincin...@googlegroups.com
I can't say it's the right way to do it because it causes some pain in other areas, but the Logstash project generates several Gemfile.lock files and uses some scripts to make sure the right one gets actually used.

~Greg Mefford
--

---
You received this message because you are subscribed to the Google Groups "Cincinnati.rb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cincinnatirb...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gary Iams

unread,
Nov 10, 2014, 11:26:28 AM11/10/14
to cincin...@googlegroups.com
On 2014.11.09 at 18:29:02 , Greg Mefford (gr...@gregmefford.com) wrote:
I can't say it's the right way to do it because it causes some pain in other areas, but the Logstash project generates several Gemfile.lock files and uses some scripts to make sure the right one gets actually used.

~Greg Mefford

On Sunday, November 9, 2014, Ed Sumerfield <esum...@bitbashers.org> wrote:
I am using pry for a product on mac and windows and it is dependent on win32console on the windows platform only. How can I manage the Gemfile.lock in source control if it changes every time I switch platforms?

Hey guys,

Bundler's :platforms feature has you covered all the way down to the operating system, in this case. For the gory details, check out the relevant section of its manpage (http://bundler.io/v1.3/man/gemfile.5.html. Rewrite your original

  if RUBY_PLATFORM =~ /mingw32/
    gem 'win32console', '1.3.2'
  end

as

gem 'win32console', '1.3.2', platforms: :mswin

And you should be gtg.

Hope that helps,

--
-Gary Iams
Reply all
Reply to author
Forward
0 new messages