How to tell Bundler to NOT use any --pre version?

208 views
Skip to first unread message

Mario Zaizar

unread,
Mar 1, 2016, 1:30:59 PM3/1/16
to ruby-bundler
Hello, I'm trying to standardize bundler version across all the devs. Specially since different bundler versions seems to update the Gemfile.lock file adding or removing the `RUBY VERSION` section at the end.

I tried specifying the latest stable version of bundler:

Gemfile:

gem 'bundler', '1.11.2'

My Gemfile.lock:

bundler (= 1.11.2)
   
...
BUNDLED WITH
1.11.2



But if anyone runs `gem install bundler --pre;`, and then `bundle check; bundle install` Bundler will use the beta version and change the lock file to:

BUNDLED WITH
1.12.0.pre

Is there any way to lock Bundler?

Mario Zaizar

unread,
Mar 1, 2016, 2:10:46 PM3/1/16
to ruby-b...@googlegroups.com
Thanks for your comments Samuel, unfortunately using another gem to validate bundler that seems risky. 
It still feels weird to me that Bundler is not able to prevent beta versions to be used (specially if you specify only acceptable version to use)

I guess there is no way to prevent people having/using the pre versions, or avoid changes to the BUNDLED WITH and RUBY VERSION sections in the lock file caused by this.

I guess I will just ignore this merge conflicts, or implement an external validations for this. Thanks anyways.

-Mario

From: Samuel Giddins <ruby-b...@googlegroups.com>
Reply: ruby-b...@googlegroups.com <ruby-b...@googlegroups.com>
Date: March 1, 2016 at 10:37:59 AM
To: Mario Zaizar <mario...@gmail.com>
Subject:  Re: How to tell Bundler to NOT use any --pre version?

Bundler is unable to lock itself, since it is being invoked by RubyGems. One option for you it to use the postit gem, which will automatically load the correct bundler version. (https://github.com/segiddins/postit)


Samuel Giddins

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

André Arko

unread,
Mar 1, 2016, 2:24:31 PM3/1/16
to ruby-b...@googlegroups.com
Bundler itself does not respect Gemfile version requirements because it would disable many existing applications—some versions of Rails say that they depend on Bundler 1.0.x, and Bundler 1.1 had to start ignoring that requirement to continue functioning in those applications.

You can implement your own exception, if you really want to, by adding a line like this to the top of your Gemfile:

raise “You need Bundler version 1.11.2” unless Bundler::VERSION == “1.11.2”



> On Mar 1, 2016, at 11:12 AM, Mario Zaizar <mario...@gmail.com> wrote:
>
> Thanks for your comments Samuel, unfortunately using another gem to validate bundler that seems risky.
> It still feels weird to me that Bundler is not able to prevent beta versions to be used (specially if you specify only acceptable version to use)
>
> I guess there is no way to prevent people having/using the pre versions, or avoid changes to the BUNDLED WITH and RUBY VERSION sections in the lock file caused by this.
>
> I guess I will just ignore this merge conflicts, or implement an external validations for this. Thanks anyways.
>
> -Mario
>
> From: Samuel Giddins <ruby-b...@googlegroups.com>
> Reply: ruby-b...@googlegroups.com <ruby-b...@googlegroups.com>
> Date: March 1, 2016 at 10:37:59 AM
> To: Mario Zaizar <mario...@gmail.com>
> Subject: Re: How to tell Bundler to NOT use any --pre version?
>
>> Bundler is unable to lock itself, since it is being invoked by RubyGems. One option for you it to use the postit gem, which will automatically load the correct bundler version. (https://github.com/segiddins/postit)
>>
>> —
>> Samuel Giddins
>>
Reply all
Reply to author
Forward
0 new messages