aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-04-23 13:28:01 -0700
committerCarl Lerche <carllerche@mac.com>2010-04-23 13:28:01 -0700
commitf7cc3d6d6d960ffcde467af86384e3d8738c5d78 (patch)
treeb602462d7c86a382791c002a34dc28e955d13bda /lib
parent4d6f5c4ce372d7e636478e38ec48f28c6f44129d (diff)
downloadbundler-f7cc3d6d6d960ffcde467af86384e3d8738c5d78.tar.gz
Push installed gems into the Rubygems source for remote specs
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/installer.rb2
-rw-r--r--lib/bundler/source.rb13
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index 5c99adaa..2ee70ebe 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -70,8 +70,6 @@ module Bundler
idx.use source.specs
end
- idx.use Index.system_gems
-
rubygems.each do |source|
Bundler.ui.debug "Source: Processing index"
idx.use source.specs
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index e0e97888..720ffc8c 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -6,6 +6,7 @@ require "open3"
module Bundler
module Source
+ # TODO: Refactor this class
class Rubygems
attr_reader :remotes
@@ -14,6 +15,7 @@ module Bundler
@remotes = (options["remotes"] || []).map { |r| normalize_uri(r) }
# @caches = (options["caches"] || [])
# Hardcode the paths for now
+ @installed = {}
@caches = [ "#{Bundler.root}/vendor/cache",
"#{Bundler.bundle_path}/cache"]
@spec_fetch_map = {}
@@ -57,6 +59,8 @@ module Bundler
File.exist?(path)
end
+ return if @installed[spec.full_name]
+
installer = Gem::Installer.new path,
:install_dir => Gem.dir,
:ignore_dependencies => true,
@@ -87,9 +91,18 @@ module Bundler
idx = Index.new
fetch_remote_specs(idx)
fetch_cached_specs(idx)
+ fetch_installed_specs(idx)
idx
end
+ def fetch_installed_specs(idx)
+ Gem::SourceIndex.from_installed_gems.to_a.reverse.each do |name, spec|
+ @installed[spec.full_name] = true
+ spec.source = self
+ idx << spec
+ end
+ end
+
def fetch_cached_specs(idx)
@caches.each do |path|
Dir["#{path}/*.gem"].each do |gemfile|