summaryrefslogtreecommitdiff
path: root/lib/bundler/source/rubygems.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/source/rubygems.rb')
-rw-r--r--lib/bundler/source/rubygems.rb37
1 files changed, 25 insertions, 12 deletions
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index 2b7cfd53b9..b4bb3d1980 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -26,6 +26,12 @@ module Bundler
Array(options["remotes"]).reverse_each {|r| add_remote(r) }
end
+ def local_only!
+ @specs = nil
+ @allow_local = true
+ @allow_remote = false
+ end
+
def local!
return if @allow_local
@@ -61,13 +67,13 @@ module Bundler
o.is_a?(Rubygems) && (o.credless_remotes - credless_remotes).empty?
end
- def disable_multisource?
- @remotes.size <= 1
+ def multiple_remotes?
+ @remotes.size > 1
end
def can_lock?(spec)
- return super if disable_multisource?
- spec.source.is_a?(Rubygems)
+ return super unless multiple_remotes?
+ include?(spec.source)
end
def options
@@ -259,8 +265,16 @@ module Bundler
!equivalent
end
+ def spec_names
+ if @allow_remote && dependency_api_available?
+ remote_specs.spec_names
+ else
+ []
+ end
+ end
+
def unmet_deps
- if @allow_remote && api_fetchers.any?
+ if @allow_remote && dependency_api_available?
remote_specs.unmet_dependency_names
else
[]
@@ -276,7 +290,7 @@ module Bundler
def double_check_for(unmet_dependency_names)
return unless @allow_remote
- return unless api_fetchers.any?
+ return unless dependency_api_available?
unmet_dependency_names = unmet_dependency_names.call
unless unmet_dependency_names.nil?
@@ -298,17 +312,20 @@ module Bundler
remote_specs.each do |spec|
case spec
when EndpointSpecification, Gem::Specification, StubSpecification, LazySpecification
- names.concat(spec.runtime_dependencies)
+ names.concat(spec.runtime_dependencies.map(&:name))
when RemoteSpecification # from the full index
return nil
else
raise "unhandled spec type (#{spec.inspect})"
end
end
- names.map!(&:name) if names
names
end
+ def dependency_api_available?
+ api_fetchers.any?
+ end
+
protected
def credless_remotes
@@ -387,10 +404,6 @@ module Bundler
next if gemfile =~ /^bundler\-[\d\.]+?\.gem/
s ||= Bundler.rubygems.spec_from_gem(gemfile)
s.source = self
- if Bundler.rubygems.spec_missing_extensions?(s, false)
- Bundler.ui.debug "Source #{self} is ignoring #{s} because it is missing extensions"
- next
- end
idx << s
end