File tree Expand file tree Collapse file tree 4 files changed +21
-5
lines changed
Expand file tree Collapse file tree 4 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ def initialize(*args)
6969
7070 # lock --lockfile works differently than install --lockfile
7171 unless current_cmd == "lock"
72- custom_lockfile = options [ :lockfile ] || Bundler . settings [ :lockfile ]
72+ custom_lockfile = options [ :lockfile ] || ENV [ "BUNDLE_LOCKFILE" ] || Bundler . settings [ :lockfile ]
7373 if custom_lockfile && !custom_lockfile . empty?
7474 Bundler ::SharedHelpers . set_env "BUNDLE_LOCKFILE" , File . expand_path ( custom_lockfile )
7575 reset_settings = true
@@ -282,8 +282,10 @@ def install
282282 end
283283
284284 require_relative "cli/install"
285+ options = self . options . dup
286+ options [ "lockfile" ] ||= ENV [ "BUNDLE_LOCKFILE" ]
285287 Bundler . settings . temporary ( no_install : false ) do
286- Install . new ( options . dup ) . run
288+ Install . new ( options ) . run
287289 end
288290 end
289291
Original file line number Diff line number Diff line change @@ -494,9 +494,9 @@ The \fBbundle install\fR \fB\-\-no\-lock\fR option (which disables lockfile crea
494494.IP " 2." 4
495495The \fB bundle install \fR \fB \-\- lockfile \fR option\.
496496.IP " 3." 4
497- The \fB lockfile \fR method in the Gemfile\.
498- .IP " 4." 4
499497The \fB BUNDLE_LOCKFILE \fR environment variable\.
498+ .IP " 4." 4
499+ The \fB lockfile \fR method in the Gemfile\.
500500.IP " 5." 4
501501The default behavior of adding \fB \. lock \fR to the end of the Gemfile name\.
502502.IP " " 0
Original file line number Diff line number Diff line change @@ -581,6 +581,6 @@ following precedence is used:
581581
5825821 . The ` bundle install ` ` --no-lock ` option (which disables lockfile creation).
5835831 . The ` bundle install ` ` --lockfile ` option.
584- 1 . The ` lockfile ` method in the Gemfile.
5855841 . The ` BUNDLE_LOCKFILE ` environment variable.
585+ 1 . The ` lockfile ` method in the Gemfile.
5865861 . The default behavior of adding ` .lock ` to the end of the Gemfile name.
Original file line number Diff line number Diff line change 4141 expect ( bundled_app ( "OmgFile.lock" ) ) . to exist
4242 end
4343
44+ it "creates lockfile using BUNDLE_LOCKFILE instead of lockfile method" do
45+ ENV [ "BUNDLE_LOCKFILE" ] = "ReallyOmgFile.lock"
46+ install_gemfile <<-G
47+ lockfile "OmgFile.lock"
48+ source "https://gem.repo1"
49+ gem "myrack", "1.0"
50+ G
51+
52+ expect ( bundled_app ( "ReallyOmgFile.lock" ) ) . to exist
53+ expect ( bundled_app ( "OmgFile.lock" ) ) . not_to exist
54+ ensure
55+ ENV . delete ( "BUNDLE_LOCKFILE" )
56+ end
57+
4458 it "creates lockfile based on --lockfile option is given" do
4559 gemfile bundled_app ( "OmgFile" ) , <<-G
4660 source "https://gem.repo1"
You can’t perform that action at this time.
0 commit comments