From 3be9c937ba2a1cc3855be5372813ac30d63053a7 Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Mon, 26 Apr 2010 14:46:06 -0700 Subject: Move the index builder onto the definition class --- lib/bundler/definition.rb | 14 ++++++++++++++ lib/bundler/environment.rb | 10 +++++----- lib/bundler/installer.rb | 6 ------ 3 files changed, 19 insertions(+), 11 deletions(-) (limited to 'lib/bundler') diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 6b2c4c16..63681886 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -32,6 +32,20 @@ module Bundler end end + def index + @index ||= Index.build do |idx| + sources.each do |s| + idx.use s.local_specs + end + end + end + + def remote_index + @remote_index ||= Index.build do |idx| + sources.each { |source| idx.use source.specs } + end + end + def no_sources? sources.length == 1 && sources.first.remotes.empty? end diff --git a/lib/bundler/environment.rb b/lib/bundler/environment.rb index 22f958c1..e2e79ad3 100644 --- a/lib/bundler/environment.rb +++ b/lib/bundler/environment.rb @@ -10,11 +10,11 @@ module Bundler end def index - @index ||= Index.build do |idx| - sources.each do |s| - idx.use s.local_specs - end - end + @definition.index + end + + def remote_index + @definition.remote_index end def requested_specs diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index ab0b0dba..f40000a3 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -60,11 +60,5 @@ module Bundler def ambiguous?(dep) dep.requirement.requirements.any? { |op,_| op != '=' } end - - def remote_index - @remote_index ||= Index.build do |idx| - sources.each { |source| idx.use source.specs } - end - end end end -- cgit v1.2.3