lib/bundler/source/rubygems.rb in bundler-2.2.25 vs lib/bundler/source/rubygems.rb in bundler-2.2.26
- old
+ new
@@ -24,16 +24,10 @@
@caches = [cache_path, *Bundler.rubygems.gem_cache]
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
@specs = nil
@allow_local = true
@@ -48,10 +42,11 @@
def cached!
return if @allow_cached
@specs = nil
+ @allow_local = true
@allow_cached = true
end
def hash
@remotes.hash
@@ -94,15 +89,26 @@
out << " remote: #{suppress_configured_credentials remote}\n"
end
out << " specs:\n"
end
+ def to_err
+ if remotes.empty?
+ "locally installed gems"
+ elsif @allow_remote
+ "rubygems repository #{remote_names} or installed locally"
+ elsif @allow_cached
+ "cached gems from rubygems repository #{remote_names} or installed locally"
+ else
+ "locally installed gems"
+ end
+ end
+
def to_s
if remotes.empty?
"locally installed gems"
else
- remote_names = remotes.map(&:to_s).join(", ")
"rubygems repository #{remote_names} or installed locally"
end
end
alias_method :name, :to_s
@@ -316,9 +322,13 @@
def dependency_api_available?
api_fetchers.any?
end
protected
+
+ def remote_names
+ remotes.map(&:to_s).join(", ")
+ end
def credless_remotes
remotes.map(&method(:suppress_configured_credentials))
end