diff options
author | The Bundler Bot <bot@bundler.io> | 2018-03-12 06:28:44 +0000 |
---|---|---|
committer | Colby Swandale <me@colby.fyi> | 2018-04-20 10:27:32 +1000 |
commit | 5d69c54e088dbcd15b45148135673cbadbb23e16 (patch) | |
tree | 2b0770239acc0fadc2295b8ec4b14120f29bbee5 | |
parent | aa133da3e7e151bb3b10644adc3639e0b8a514d4 (diff) | |
download | bundler-5d69c54e088dbcd15b45148135673cbadbb23e16.tar.gz |
Auto merge of #6335 - bundler:segiddins/use-rubygems-integration-inflate, r=segiddins
Use Bundler.rubygems.inflate instead of the Gem::Util method directly
### What was the end-user problem that led to this PR?
The problem was Bundler was using RubyGems methods directly that may change their interface over time.
### What was your diagnosis of the problem?
My diagnosis was we should use `Bundler.rubygems` to encapsulate those method calls.
(cherry picked from commit 331ade5e654b4cb5cfcafff159593d2bb63d5b1b)
-rw-r--r-- | lib/bundler/fetcher.rb | 4 | ||||
-rw-r--r-- | lib/bundler/fetcher/index.rb | 4 | ||||
-rw-r--r-- | spec/install/gems/resolving_spec.rb | 2 | ||||
-rw-r--r-- | spec/support/artifice/compact_index.rb | 2 | ||||
-rw-r--r-- | spec/support/artifice/endpoint.rb | 2 |
5 files changed, 7 insertions, 7 deletions
diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb index 3538b668fa..444778b36b 100644 --- a/lib/bundler/fetcher.rb +++ b/lib/bundler/fetcher.rb @@ -96,11 +96,11 @@ module Bundler uri = URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz") if uri.scheme == "file" - Bundler.load_marshal Gem::Util.inflate(Gem.read_binary(uri.path)) + Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(uri.path)) elsif cached_spec_path = gemspec_cached_path(spec_file_name) Bundler.load_gemspec(cached_spec_path) else - Bundler.load_marshal Gem::Util.inflate(downloader.fetch(uri).body) + Bundler.load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body) end rescue MarshalError raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \ diff --git a/lib/bundler/fetcher/index.rb b/lib/bundler/fetcher/index.rb index 19b37ee548..1a8064624d 100644 --- a/lib/bundler/fetcher/index.rb +++ b/lib/bundler/fetcher/index.rb @@ -29,11 +29,11 @@ module Bundler uri = URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz") if uri.scheme == "file" - Bundler.load_marshal Gem::Util.inflate(Gem.read_binary(uri.path)) + Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(uri.path)) elsif cached_spec_path = gemspec_cached_path(spec_file_name) Bundler.load_gemspec(cached_spec_path) else - Bundler.load_marshal Gem::Util.inflate(downloader.fetch(uri).body) + Bundler.load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body) end rescue MarshalError raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \ diff --git a/spec/install/gems/resolving_spec.rb b/spec/install/gems/resolving_spec.rb index cf9f19980a..2925542d86 100644 --- a/spec/install/gems/resolving_spec.rb +++ b/spec/install/gems/resolving_spec.rb @@ -22,7 +22,7 @@ RSpec.describe "bundle install with install-time dependencies" do build_repo2 path = "#{gem_repo2}/#{Gem::MARSHAL_SPEC_DIR}/actionpack-2.3.2.gemspec.rz" - spec = Marshal.load(Gem::Util.inflate(File.read(path))) + spec = Marshal.load(Bundler.rubygems.inflate(File.read(path))) spec.dependencies.each do |d| d.instance_variable_set(:@type, :fail) end diff --git a/spec/support/artifice/compact_index.rb b/spec/support/artifice/compact_index.rb index 2db2cd2c27..01e8eb7837 100644 --- a/spec/support/artifice/compact_index.rb +++ b/spec/support/artifice/compact_index.rb @@ -10,7 +10,7 @@ class CompactIndexAPI < Endpoint def load_spec(name, version, platform, gem_repo) full_name = "#{name}-#{version}" full_name += "-#{platform}" if platform != "ruby" - Marshal.load(Gem::Util.inflate(File.open(gem_repo.join("quick/Marshal.4.8/#{full_name}.gemspec.rz")).read)) + Marshal.load(Bundler.rubygems.inflate(File.open(gem_repo.join("quick/Marshal.4.8/#{full_name}.gemspec.rz")).read)) end def etag_response diff --git a/spec/support/artifice/endpoint.rb b/spec/support/artifice/endpoint.rb index 84dbcfd345..9a0cfae8a2 100644 --- a/spec/support/artifice/endpoint.rb +++ b/spec/support/artifice/endpoint.rb @@ -68,7 +68,7 @@ class Endpoint < Sinatra::Base def load_spec(name, version, platform, gem_repo) full_name = "#{name}-#{version}" full_name += "-#{platform}" if platform != "ruby" - Marshal.load(Gem::Util.inflate(File.open(gem_repo.join("quick/Marshal.4.8/#{full_name}.gemspec.rz")).read)) + Marshal.load(Bundler.rubygems.inflate(File.open(gem_repo.join("quick/Marshal.4.8/#{full_name}.gemspec.rz")).read)) end end |