diff options
author | Laura Paakkinen <laura.paakkinen@u2i.com> | 2018-10-18 08:09:44 +0200 |
---|---|---|
committer | Laura Paakkinen <laura.paakkinen@u2i.com> | 2018-10-18 08:12:13 +0200 |
commit | 5bd3ef0901a053b8266026d0bc47ae66b4a9d8d9 (patch) | |
tree | 5f489013fafa7d632b34bb4199af24a0cb076f41 | |
parent | 18369b8a0999f11515e28603676f99ca376d7d93 (diff) | |
download | bundler-5bd3ef0901a053b8266026d0bc47ae66b4a9d8d9.tar.gz |
Enable gemfile flag for bundle lock
-rw-r--r-- | lib/bundler/cli.rb | 2 | ||||
-rw-r--r-- | spec/commands/lock_spec.rb | 27 |
2 files changed, 29 insertions, 0 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index ad2c7c969c..c591884263 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -618,6 +618,8 @@ module Bundler "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 => diff --git a/spec/commands/lock_spec.rb b/spec/commands/lock_spec.rb index f4997b0620..d99ddaf294 100644 --- a/spec/commands/lock_spec.rb +++ b/spec/commands/lock_spec.rb @@ -89,6 +89,33 @@ RSpec.describe "bundle lock" do 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" |