Created
December 9, 2011 17:42
-
-
Save voxik/1452549 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From d35bd09c4efda2c46059f81fb3e6fc2b6a9e4c12 Mon Sep 17 00:00:00 2001 | |
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <[email protected]> | |
Date: Fri, 9 Dec 2011 18:41:36 +0100 | |
Subject: [PATCH] Try to activate only inactive gems. | |
--- | |
lib/rubygems.rb | 2 +- | |
lib/rubygems/specification.rb | 10 ++++++++++ | |
2 files changed, 11 insertions(+), 1 deletions(-) | |
diff --git a/lib/rubygems.rb b/lib/rubygems.rb | |
index 0da8862..e90e786 100644 | |
--- a/lib/rubygems.rb | |
+++ b/lib/rubygems.rb | |
@@ -202,7 +202,7 @@ module Gem | |
# TODO: use find_all and bork if ambiguous | |
- spec = Gem::Specification.find_by_path path | |
+ spec = Gem::Specification.find_inactive_by_path path | |
return false unless spec | |
begin | |
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb | |
index 099d978..0e7a27a 100644 | |
--- a/lib/rubygems/specification.rb | |
+++ b/lib/rubygems/specification.rb | |
@@ -800,6 +800,16 @@ class Gem::Specification | |
end | |
## | |
+ # Return the best specification of inactive gems that contains the file | |
+ # matching +path+. | |
+ | |
+ def self.find_inactive_by_path path | |
+ self.find { |spec| | |
+ spec.contains_requirable_file? path unless spec.activated? | |
+ } | |
+ end | |
+ | |
+ ## | |
# Return currently unresolved specs that contain the file matching +path+. | |
def self.find_in_unresolved path | |
-- | |
1.7.7.3 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment