Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Enable gemfile flag for bundle lock #6748

Merged
1 commit merged into from
Oct 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/bundler/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,8 @@ def inject(name, version)
"do not attempt to fetch remote gemspecs and use the local gem cache only"
method_option "print", :type => :boolean, :default => false, :banner =>
"print the lockfile to STDOUT instead of writing to the file system"
method_option "gemfile", :type => :string, :banner =>
"Use the specified gemfile instead of Gemfile"
method_option "lockfile", :type => :string, :default => nil, :banner =>
"the path the lockfile should be written to"
method_option "full-index", :type => :boolean, :default => false, :banner =>
Expand Down
27 changes: 27 additions & 0 deletions spec/commands/lock_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,33 @@ def read_lockfile(file = "Gemfile.lock")
expect(out).to match(/sources listed in your Gemfile|installed locally/)
end

it "works with --gemfile flag" do
create_file "CustomGemfile", <<-G
source "file://localhost#{repo}"
gem "foo"
G
lockfile = strip_lockfile(normalize_uri_file(<<-L))
GEM
remote: file://localhost#{repo}/
specs:
foo (1.0)

PLATFORMS
#{lockfile_platforms}

DEPENDENCIES
foo

BUNDLED WITH
#{Bundler::VERSION}
L
bundle "lock --gemfile CustomGemfile"

expect(out).to match(/Writing lockfile to.+CustomGemfile\.lock/)
expect(read_lockfile("CustomGemfile.lock")).to eq(lockfile)
expect { read_lockfile }.to raise_error(Errno::ENOENT)
end

it "writes to a custom location using --lockfile" do
bundle "lock --lockfile=lock"

Expand Down