Created
September 11, 2008 23:35
-
-
Save halorgium/10339 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
diff --git a/lib/rubygems.rb b/lib/rubygems.rb | |
index 458a845..13994d4 100644 | |
--- a/lib/rubygems.rb | |
+++ b/lib/rubygems.rb | |
@@ -121,6 +121,8 @@ module Gem | |
# Gem::Requirement and Gem::Version documentation. | |
def self.activate(gem, *version_requirements) | |
+ options = version_requirements.last.is_a?(Hash) ? version_requirements.pop : {} | |
+ sources = options[:sources] || [] | |
if version_requirements.empty? then | |
version_requirements = Gem::Requirement.default | |
end | |
@@ -139,8 +141,9 @@ module Gem | |
existing_spec = @loaded_specs[gem.name] | |
unless matches.any? { |spec| spec.version == existing_spec.version } then | |
+ sources_message = sources.map { |spec| spec.full_name } | |
raise Gem::Exception, | |
- "can't activate #{gem}, already activated #{existing_spec.full_name}" | |
+ "can't activate #{gem} for #{sources_message.inspect}, already activated #{existing_spec.full_name}" | |
end | |
return false | |
@@ -155,7 +158,7 @@ module Gem | |
# Load dependent gems first | |
spec.runtime_dependencies.each do |dep_gem| | |
- activate dep_gem | |
+ activate dep_gem, :sources => [spec, *sources] | |
end | |
# bin directory must come before library directories | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment