From 4667c8542611cec14559c33e6a05f8811d5736e7 Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Thu, 6 Feb 2014 10:14:31 +0200 Subject: Revert "reinstalls gem if gem dir is missing but spec exists" It turns out that this has some pretty extensive repurcussions, and makes it impossible to use Bundler in some specific circumstances, like with gems that ship with Ruby, and with gems that are installed by distro packages. It also breaks the `bundle pack` command, because the gems that are cached by the pack command are not found by this check. See also: https://github.com/bundler/bundler/issues/2854 https://github.com/bundler/bundler/issues/2818 https://github.com/bundler/bundler/issues/2780 This reverts commit bd0243ee3396a74227dec330c8a2c159deccb5a7. --- lib/bundler/source/rubygems.rb | 13 +------------ spec/install/gems/simple_case_spec.rb | 16 ---------------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index 880f78ee7d..f69a5b3e8e 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -4,7 +4,6 @@ require 'rubygems/spec_fetcher' module Bundler module Source - # TODO: Refactor this class class Rubygems API_REQUEST_LIMIT = 100 # threshold for switching back to the modern index instead of fetching every spec @@ -68,7 +67,7 @@ module Bundler end def install(spec) - if installed_specs[spec].any? && gem_dir_exists?(spec) + if installed_specs[spec].any? return ["Using #{spec.name} (#{spec.version})", nil] end @@ -277,16 +276,6 @@ module Bundler end end - def gem_dir_exists?(spec) - return true if spec.name == "bundler" - # Ruby 2 default gems - return true if spec.loaded_from.include?("specifications/default/") - # Ruby 1.9 default gems - return true if spec.summary =~ /is bundled with Ruby/ - - File.directory?(spec.full_gem_path) - end end - end end diff --git a/spec/install/gems/simple_case_spec.rb b/spec/install/gems/simple_case_spec.rb index 431cdc2376..505e3d1f7e 100644 --- a/spec/install/gems/simple_case_spec.rb +++ b/spec/install/gems/simple_case_spec.rb @@ -337,22 +337,6 @@ describe "bundle install with gem sources" do G expect(exitstatus).to eq(0) end - - it "reinstalls the gem if the gem dir is missing but the specification file exists" do - gemfile(<<-G) - source "file://#{gem_repo1}" - - gem 'foo' - G - - bundle "install --path vendor/bundle" - - FileUtils.rm_rf(vendored_gems('gems/foo-1.0')) - - bundle "install" - - expect(vendored_gems('gems/foo-1.0')).to exist - end end describe "when Bundler root contains regex chars" do -- cgit v1.2.1