diff options
author | Asutosh Palai <asupalai@gmail.com> | 2016-08-10 00:08:52 +0530 |
---|---|---|
committer | Asutosh Palai <asupalai@gmail.com> | 2016-08-10 00:08:52 +0530 |
commit | 888041af40a9e7a9a173439c41f2961de152b39c (patch) | |
tree | 383f04eaeec9a96d4ca175be36a1fdeb11c2eaa5 | |
parent | 292fb5857c8c4f743675db687feb102e7a7a70c1 (diff) | |
download | bundler-888041af40a9e7a9a173439c41f2961de152b39c.tar.gz |
Fixed plugin reset in bundler reset
-rw-r--r-- | lib/bundler.rb | 4 | ||||
-rw-r--r-- | spec/bundler/plugin/index_spec.rb | 8 | ||||
-rw-r--r-- | spec/bundler/plugin/installer_spec.rb | 6 | ||||
-rw-r--r-- | spec/plugins/install_spec.rb | 8 | ||||
-rw-r--r-- | spec/support/path.rb | 4 |
5 files changed, 16 insertions, 14 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index 6ed4de3815..58d8f03920 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -389,11 +389,13 @@ module Bundler @locked_gems = nil @bundle_path = nil @bin_path = nil + + Plugin.reset! + return unless defined?(@rubygems) && @rubygems rubygems.undo_replacements rubygems.reset @rubygems = nil - Plugin.reset! end private diff --git a/spec/bundler/plugin/index_spec.rb b/spec/bundler/plugin/index_spec.rb index 9301d8c3f6..337182abf1 100644 --- a/spec/bundler/plugin/index_spec.rb +++ b/spec/bundler/plugin/index_spec.rb @@ -81,10 +81,10 @@ describe Bundler::Plugin::Index do describe "global index" do before do - Dir.chdir tmp - path = lib_path("gplugin") - index.register_plugin("gplugin", path.to_s, [path.join("lib").to_s], [], ["glb_source"]) - Dir.chdir bundled_app + Dir.chdir(tmp) do + path = lib_path("gplugin") + index.register_plugin("gplugin", path.to_s, [path.join("lib").to_s], [], ["glb_source"]) + end end it "skips sources" do diff --git a/spec/bundler/plugin/installer_spec.rb b/spec/bundler/plugin/installer_spec.rb index 0cdd36ee2a..9d6eb1c55b 100644 --- a/spec/bundler/plugin/installer_spec.rb +++ b/spec/bundler/plugin/installer_spec.rb @@ -75,7 +75,7 @@ describe Bundler::Plugin::Installer do it "has expected full_gem)path" do expect(result["re-plugin"].full_gem_path). - to eq(global_plugin_gems("re-plugin-1.0").to_s) + to eq(global_plugin_gem("re-plugin-1.0").to_s) end end @@ -90,8 +90,8 @@ describe Bundler::Plugin::Installer do end it "has expected full_gem)path" do - expect(result["re-plugin"].full_gem_path).to eq(global_plugin_gems("re-plugin-1.0").to_s) - expect(result["ma-plugin"].full_gem_path).to eq(global_plugin_gems("ma-plugin-1.0").to_s) + expect(result["re-plugin"].full_gem_path).to eq(global_plugin_gem("re-plugin-1.0").to_s) + expect(result["ma-plugin"].full_gem_path).to eq(global_plugin_gem("ma-plugin-1.0").to_s) end end end diff --git a/spec/plugins/install_spec.rb b/spec/plugins/install_spec.rb index eed02c92c5..5f200d6717 100644 --- a/spec/plugins/install_spec.rb +++ b/spec/plugins/install_spec.rb @@ -78,7 +78,7 @@ describe "bundler plugin install" do expect(out).to include("plugins.rb was not found") - expect(global_plugin_gems("charlie-1.0")).not_to be_directory + expect(global_plugin_gem("charlie-1.0")).not_to be_directory plugin_should_not_be_installed("charlie") end @@ -94,7 +94,7 @@ describe "bundler plugin install" do bundle "plugin install chaplin --source file://#{gem_repo2}" - expect(global_plugin_gems("chaplin-1.0")).not_to be_directory + expect(global_plugin_gem("chaplin-1.0")).not_to be_directory plugin_should_not_be_installed("chaplin") end @@ -176,7 +176,7 @@ describe "bundler plugin install" do RUBY ruby code - expect(local_plugin_gems("foo-1.0", "plugins.rb")).to exist + expect(local_plugin_gem("foo-1.0", "plugins.rb")).to exist end end @@ -186,7 +186,7 @@ describe "bundler plugin install" do bundle "plugin install foo --source file://#{gem_repo2}" plugin_should_be_installed("foo") - expect(local_plugin_gems("foo-1.0")).to be_directory + expect(local_plugin_gem("foo-1.0")).to be_directory end context "conflict with global plugin" do diff --git a/spec/support/path.rb b/spec/support/path.rb index bd6cd4e47a..cf77adb509 100644 --- a/spec/support/path.rb +++ b/spec/support/path.rb @@ -81,11 +81,11 @@ module Spec Pathname.new(File.expand_path("../../../lib", __FILE__)) end - def global_plugin_gems(*args) + def global_plugin_gem(*args) home ".bundle", "plugin", "gems", *args end - def local_plugin_gems(*args) + def local_plugin_gem(*args) bundled_app ".bundle", "plugin", "gems", *args end |