summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2019-03-03 18:58:37 +0000
committerBundlerbot <bot@bundler.io>2019-03-03 18:58:37 +0000
commit493b4438db43acd1f90228406fa6e6fda96009c8 (patch)
treef0ea33fdf2385f280fcbcee5328d7ec978532a86
parenteeb5722f24e8868cbbf3687cc772254ac65d19df (diff)
parenta0b91e3ad4e9243bdf73ca4eab6e755d93318899 (diff)
downloadbundler-493b4438db43acd1f90228406fa6e6fda96009c8.tar.gz
Merge #6978
6978: Add check for already installed plugin r=deivid-rodriguez a=ankitkataria ### What was the end-user problem that led to this PR? Fixes #6946 ### What was your diagnosis of the problem? There was no check to ensure that the plugin was already installed or not. ### What is your fix for the problem, implemented in this PR? I added the check [here](https://github.com/bundler/bundler/compare/master...ankitkataria:plugin-fix?expand=1#diff-68bd939cd3589d8fdda08a12433659ebR109) I also added a small test for the same Co-authored-by: Ankit Kataria <ankitkataria28@gmail.com>
-rw-r--r--lib/bundler/source/rubygems.rb2
-rw-r--r--spec/plugins/install_spec.rb14
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index 9e5032c079..88d88320e6 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -106,7 +106,7 @@ module Bundler
end
end
- if installed?(spec) && !force
+ if (installed?(spec) || Plugin.installed?(spec.name)) && !force
print_using_message "Using #{version_message(spec)}"
return nil # no post-install message
end
diff --git a/spec/plugins/install_spec.rb b/spec/plugins/install_spec.rb
index 3d13278d9c..afc6087c1b 100644
--- a/spec/plugins/install_spec.rb
+++ b/spec/plugins/install_spec.rb
@@ -22,6 +22,18 @@ RSpec.describe "bundler plugin install" do
plugin_should_be_installed("foo")
end
+ context "plugin is already installed" do
+ before do
+ bundle "plugin install foo --source file://#{gem_repo2}"
+ end
+
+ it "doesn't install plugin again" do
+ bundle "plugin install foo --source file://#{gem_repo2}"
+ expect(out).not_to include("Installing plugin foo")
+ expect(out).not_to include("Installed plugin foo")
+ end
+ end
+
it "installs multiple plugins" do
bundle "plugin install foo kung-foo --source file://#{gem_repo2}"
@@ -165,7 +177,7 @@ RSpec.describe "bundler plugin install" do
build_plugin "foo", "1.1.0"
end
- install_gemfile <<-G
+ gemfile <<-G
source 'file://#{gem_repo2}'
plugin 'foo', "1.0"
G