summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/cli.rb1
-rw-r--r--spec/commands/exec_spec.rb9
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"