diff options
author | The Bundler Bot <bot@bundler.io> | 2018-09-03 07:51:46 +0000 |
---|---|---|
committer | The Bundler Bot <bot@bundler.io> | 2018-09-03 07:51:46 +0000 |
commit | c4892480aba36d31a3b6e232f17a705aaad1b730 (patch) | |
tree | 5f488a06455a8e5ec0e3d565324ce27c7b1e7caa | |
parent | d9ffe1ecaf459baef83f08f481a15e7f72738c81 (diff) | |
parent | 94b71049f946a0cbcd9bc26f0eb6c83e3108d794 (diff) | |
download | bundler-c4892480aba36d31a3b6e232f17a705aaad1b730.tar.gz |
Auto merge of #6676 - ankitkataria:gemfile-flag, r=colby-swandale
Add gemfile flag to exec command
### What was the end-user problem that led to this PR?
This PR resolves the issue #5924
### What was your diagnosis of the problem?
- added a `gemfile` flag in `cli.rb`
- if `options[:gemfile]` is set I created a SharedHelper method `custom_gemfile` which used the predefined `find_file` function to find and set the environment variable with the argument provided
-rw-r--r-- | lib/bundler/cli.rb | 1 | ||||
-rw-r--r-- | spec/commands/exec_spec.rb | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index f1ff3f4554..f692ae5f13 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -437,6 +437,7 @@ module Bundler desc "exec [OPTIONS]", "Run the command in context of the bundle" method_option :keep_file_descriptors, :type => :boolean, :default => false + method_option :gemfile, :type => :string, :required => false long_desc <<-D Exec runs a command, providing it access to the gems in the bundle. While using bundle exec you can require and call the bundled gems as if they were installed diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index 5ece0bccc3..95c10c0a9f 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -6,6 +6,15 @@ RSpec.describe "bundle exec" do system_gems(system_gems_to_install, :path => :bundle_path) end + it "works with --gemfile flag" do + create_file "CustomGemfile", <<-G + gem "rack", "1.0.0" + G + + bundle "exec --gemfile CustomGemfile rackup" + expect(out).to eq("1.0.0") + end + it "activates the correct gem" do gemfile <<-G gem "rack", "0.9.1" |