From 5222201bd99691eb4ec9b43b62ebca304659a010 Mon Sep 17 00:00:00 2001 From: David Kellum Date: Fri, 2 Sep 2016 09:22:57 -0700 Subject: [PATCH 1/4] [RubygemsExt] Add missing require rubygems/source The change referenced below as released in 1.13.0.rc.2, may attempt to reference Gem::Source without it being loaded, resulting in: [!] There was an error parsing `Gemfile`: [!] There was an error while loading `elided.gemspec`: uninitialized constant Gem::Source. Bundler cannot continue. Observed this on ruby 2.2.5 with stock rubygems 2.4.5 as well as upgraded rubygems 2.6.6. Add this require. commit f9de70ee931ca4a8500916fa9480f6df6c062626 Author: Samuel Giddins AuthorDate: Sun Jul 10 11:06:49 2016 -0300 Commit: Samuel Giddins CommitDate: Tue Jul 19 17:13:19 2016 -0500 [RubygemsExt] return Source::Installed from #source when appropriate --- lib/bundler/rubygems_ext.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index 7cd83e631e7..e8fcd6fd434 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -8,6 +8,7 @@ require "rubygems" require "rubygems/specification" +require "rubygems/source" require "bundler/match_platform" module Gem From 2dda88ec6722a5c652319127d2d6e94edfb93e22 Mon Sep 17 00:00:00 2001 From: David Kellum Date: Fri, 2 Sep 2016 14:10:20 -0700 Subject: [PATCH 2/4] Get it passing for rubygems <2.0.0 --- lib/bundler/rubygems_ext.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index e8fcd6fd434..0401e032da0 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -8,7 +8,15 @@ require "rubygems" require "rubygems/specification" -require "rubygems/source" + +begin + # Possible use in Gem::Specification#source below and require + # shouldn't be deferred. + require "rubygems/source" +rescue LoadError + # Not available before Rubygems 2.0.0, ignore +end + require "bundler/match_platform" module Gem From 9748a78494e3c507be3f818d325421b632118af4 Mon Sep 17 00:00:00 2001 From: David Kellum Date: Fri, 2 Sep 2016 14:25:43 -0700 Subject: [PATCH 3/4] If this works, you are just as nuisance, Rubocop --- lib/bundler/rubygems_ext.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index 0401e032da0..4593db87c3c 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -13,8 +13,9 @@ # Possible use in Gem::Specification#source below and require # shouldn't be deferred. require "rubygems/source" -rescue LoadError +rescue LoadError => e # Not available before Rubygems 2.0.0, ignore + nil end require "bundler/match_platform" From 34404bb32945429ffedd484f8f3447529b3b33f4 Mon Sep 17 00:00:00 2001 From: David Kellum Date: Fri, 2 Sep 2016 14:30:21 -0700 Subject: [PATCH 4/4] But I only put that there to amuse you, Rubocop --- lib/bundler/rubygems_ext.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index 4593db87c3c..53a153e560c 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -13,7 +13,7 @@ # Possible use in Gem::Specification#source below and require # shouldn't be deferred. require "rubygems/source" -rescue LoadError => e +rescue LoadError # Not available before Rubygems 2.0.0, ignore nil end