lib/bundler/rubygems_integration.rb in bundler-1.11.2 vs lib/bundler/rubygems_integration.rb in bundler-1.12.0.pre.1
- old
+ new
@@ -1,5 +1,6 @@
+# frozen_string_literal: true
require "monitor"
require "rubygems"
require "rubygems/config_file"
module Bundler
@@ -62,11 +63,11 @@
end
def configuration
require "bundler/psyched_yaml"
Gem.configuration
- rescue Gem::SystemExitException => e
+ rescue Gem::SystemExitException, LoadError => e
Bundler.ui.error "#{e.class}: #{e.message}"
Bundler.ui.trace e
raise
rescue YamlLibrarySyntaxError => e
raise YamlSyntaxError.new(e, "Your RubyGems configuration, which is " \
@@ -179,11 +180,11 @@
end
def fetch_prerelease_specs
fetch_specs(false, true)
rescue Gem::RemoteFetcher::FetchError
- [] # if we can't download them, there aren't any
+ {} # if we can't download them, there aren't any
end
# TODO: This is for older versions of Rubygems... should we support the
# X-Gemfile-Source header on these old versions?
# Maybe the newer implementation will work on older Rubygems?
@@ -192,13 +193,13 @@
old_sources = Bundler.rubygems.sources
Bundler.rubygems.sources = [remote.uri.to_s]
# Fetch all specs, minus prerelease specs
spec_list = fetch_specs(true, false)
# Then fetch the prerelease specs
- fetch_prerelease_specs.each {|k, v| spec_list[k] += v }
+ fetch_prerelease_specs.each {|k, v| spec_list[k].push(*v) }
- spec_list
+ spec_list.values.first
ensure
Bundler.rubygems.sources = old_sources
end
def with_build_args(args)
@@ -576,21 +577,15 @@
# it's okay for prerelease to fail
raise e unless name == "prerelease_specs"
end
def fetch_all_remote_specs(remote)
- # Since SpecFetcher now returns NameTuples, we just fetch directly
- # and unmarshal the array ourselves.
- hash = {}
+ source = remote.uri.is_a?(URI) ? remote.uri : URI.parse(source.to_s)
- source = remote.uri
- source = URI.parse(source.to_s) unless source.is_a?(URI)
- hash[source] = fetch_specs(source, remote, "specs")
+ specs = fetch_specs(source, remote, "specs")
+ pres = fetch_specs(source, remote, "prerelease_specs") || []
- pres = fetch_specs(source, remote, "prerelease_specs")
- hash[source].push(*pres) if pres && !pres.empty?
-
- hash
+ specs.push(*pres)
end
def download_gem(spec, uri, path)
uri = Bundler.settings.mirror_for(uri)
fetcher = gem_remote_fetcher