diff options
author | Carl Lerche <carllerche@mac.com> | 2010-04-26 14:46:06 -0700 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-04-26 14:46:06 -0700 |
commit | 3be9c937ba2a1cc3855be5372813ac30d63053a7 (patch) | |
tree | 434c0e715eba94ce02fb5952e3b8404dfadb0ae6 | |
parent | a6097c588b4e068d6968132b20d30fda50536b5c (diff) | |
download | bundler-3be9c937ba2a1cc3855be5372813ac30d63053a7.tar.gz |
Move the index builder onto the definition class
-rw-r--r-- | lib/bundler/definition.rb | 14 | ||||
-rw-r--r-- | lib/bundler/environment.rb | 10 | ||||
-rw-r--r-- | lib/bundler/installer.rb | 6 |
3 files changed, 19 insertions, 11 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 6b2c4c1633..63681886b2 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 22f958c19f..e2e79ad337 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 ab0b0dba70..f40000a36f 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 |