diff options
Diffstat (limited to 'lib/bundler')
-rw-r--r-- | lib/bundler/dsl.rb | 5 | ||||
-rw-r--r-- | lib/bundler/environment.rb | 5 | ||||
-rw-r--r-- | lib/bundler/lockfile_parser.rb | 4 | ||||
-rw-r--r-- | lib/bundler/source.rb | 11 |
4 files changed, 19 insertions, 6 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 652ee289..68c45830 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -11,7 +11,7 @@ module Bundler def initialize @rubygems_source = Source::Rubygems.new @source = nil - @sources = [@rubygems_source] + @sources = [] @dependencies = [] @group = [:default] end @@ -57,6 +57,8 @@ module Bundler end def to_definition(lockfile) + @sources << @rubygems_source + @sources.uniq! Definition.new(lockfile, @dependencies, @sources) end @@ -94,6 +96,7 @@ module Bundler def rubygems_source(source) @rubygems_source.add_remote source + @sources << @rubygems_source end def _version?(version) diff --git a/lib/bundler/environment.rb b/lib/bundler/environment.rb index 5d6f8c57..77ce4806 100644 --- a/lib/bundler/environment.rb +++ b/lib/bundler/environment.rb @@ -12,11 +12,8 @@ module Bundler def index @index ||= Index.build do |idx| sources.each do |s| - idx.use s.local_specs if s.respond_to?(:local_specs) + idx.use s.local_specs end - - idx.use Index.system_gems - idx.use Index.cached_gems end end diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb index 11a5fea1..67b477b6 100644 --- a/lib/bundler/lockfile_parser.rb +++ b/lib/bundler/lockfile_parser.rb @@ -7,7 +7,7 @@ module Bundler # Do stuff def initialize(lockfile) @rg_source = Source::Rubygems.new - @sources = [@rg_source] + @sources = [] @dependencies = [] @specs = [] @@ -24,6 +24,7 @@ module Bundler end end + @sources << @rg_source @sources.uniq! end @@ -45,6 +46,7 @@ module Bundler # There should only be one instance of a rubygem source if type == 'gem' @rg_source.add_remote source + @sources << @rg_source @rg_source else TYPES[type].from_lock(source, extra_opts.merge(options)) diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb index 720ffc8c..36b8b644 100644 --- a/lib/bundler/source.rb +++ b/lib/bundler/source.rb @@ -42,6 +42,10 @@ module Bundler @specs ||= fetch_specs end + def local_specs + @local_specs ||= fetch_local_specs + end + def fetch(spec) action = @spec_fetch_map[[spec.name, spec.version, spec.platform]] action.call if action @@ -95,6 +99,13 @@ module Bundler idx end + def fetch_local_specs + idx = Index.new + 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 |