summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-01-24 17:22:43 -0300
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-04-12 10:13:16 +0200
commit1f77be49b98c4ef4bbbe5013003e091de02d4b90 (patch)
tree43ba7a00e2e9a17ca4b299196f404a02ba8f9e65
parenta7caa4dfc94ea0fc8a1b25c216edec1531ffab6f (diff)
downloadbundler-1f77be49b98c4ef4bbbe5013003e091de02d4b90.tar.gz
Convert binstub conflict deprecation to a warning
And test it. I don't think it makes sense as a deprecation, since nothing is changing, and there's no alternative. This is a potentially undesired situation caused by gems shipping executables conflicting with the executables of other gems. `bundle exec` is fine in general, this is just a potentially undesired situation that can be fixed by using project specific binstubs.
-rw-r--r--lib/bundler/rubygems_integration.rb2
-rw-r--r--spec/commands/exec_spec.rb29
2 files changed, 30 insertions, 1 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index e8a22c4242..42466fe03e 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -459,7 +459,7 @@ module Bundler
end
unless spec.name == gem_name
- Bundler::SharedHelpers.major_deprecation 2,
+ warn \
"Bundler is using a binstub that was created for a different gem (#{spec.name}).\n" \
"You should run `bundle binstub #{gem_name}` " \
"to work around a system/bundle conflict."
diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb
index 1d84669a75..a95383ee97 100644
--- a/spec/commands/exec_spec.rb
+++ b/spec/commands/exec_spec.rb
@@ -217,6 +217,35 @@ RSpec.describe "bundle exec" do
end
end
+ it "warns about executable conflicts" do
+ build_repo2 do
+ build_gem "rack_two", "1.0.0" do |s|
+ s.executables = "rackup"
+ end
+ end
+
+ bundle "config set path.system true"
+
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack", "0.9.1"
+ G
+
+ Dir.chdir bundled_app2 do
+ install_gemfile bundled_app2("Gemfile"), <<-G
+ source "file://#{gem_repo2}"
+ gem "rack_two", "1.0.0"
+ G
+ end
+
+ bundle! "exec rackup"
+
+ expect(last_command.stderr).to eq(
+ "Bundler is using a binstub that was created for a different gem (rack).\n" \
+ "You should run `bundle binstub rack_two` to work around a system/bundle conflict."
+ )
+ end
+
it "handles gems installed with --without" do
install_gemfile <<-G, forgotten_command_line_options(:without => "middleware")
source "file://#{gem_repo1}"