From 9448fc8c37eb9f867f352c3085f20994c7726fa9 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Thu, 1 Mar 2018 12:38:43 +0900 Subject: [PATCH] Use Gem::Util.inflate instead of Gem.inflate --- lib/bundler/fetcher.rb | 4 ++-- lib/bundler/fetcher/index.rb | 4 ++-- lib/bundler/rubygems_integration.rb | 2 +- spec/install/gems/resolving_spec.rb | 2 +- spec/support/artifice/compact_index.rb | 2 +- spec/support/artifice/endpoint.rb | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb index 03ff528826f..3538b668fa6 100644 --- a/lib/bundler/fetcher.rb +++ b/lib/bundler/fetcher.rb @@ -96,11 +96,11 @@ def fetch_spec(spec) uri = URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz") if uri.scheme == "file" - Bundler.load_marshal Gem.inflate(Gem.read_binary(uri.path)) + Bundler.load_marshal Gem::Util.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.inflate(downloader.fetch(uri).body) + Bundler.load_marshal Gem::Util.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 9529944391c..19b37ee5486 100644 --- a/lib/bundler/fetcher/index.rb +++ b/lib/bundler/fetcher/index.rb @@ -29,11 +29,11 @@ def fetch_spec(spec) uri = URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz") if uri.scheme == "file" - Bundler.load_marshal Gem.inflate(Gem.read_binary(uri.path)) + Bundler.load_marshal Gem::Util.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.inflate(downloader.fetch(uri).body) + Bundler.load_marshal Gem::Util.inflate(downloader.fetch(uri).body) end rescue MarshalError raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \ diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 2d70eae7dca..231b085f052 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -132,7 +132,7 @@ def read_binary(path) end def inflate(obj) - Gem.inflate(obj) + Gem::Util.inflate(obj) end def sources=(val) diff --git a/spec/install/gems/resolving_spec.rb b/spec/install/gems/resolving_spec.rb index d3df4c4bea5..cf9f19980a1 100644 --- a/spec/install/gems/resolving_spec.rb +++ b/spec/install/gems/resolving_spec.rb @@ -22,7 +22,7 @@ build_repo2 path = "#{gem_repo2}/#{Gem::MARSHAL_SPEC_DIR}/actionpack-2.3.2.gemspec.rz" - spec = Marshal.load(Gem.inflate(File.read(path))) + spec = Marshal.load(Gem::Util.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 434307576f4..d59f59831b7 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.inflate(File.open(gem_repo.join("quick/Marshal.4.8/#{full_name}.gemspec.rz")).read)) + Marshal.load(Gem::Util.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 9afecff8e6b..84dbcfd3452 100644 --- a/spec/support/artifice/endpoint.rb +++ b/spec/support/artifice/endpoint.rb @@ -68,7 +68,7 @@ def dependencies_for(gem_names, gem_repo = GEM_REPO) def load_spec(name, version, platform, gem_repo) full_name = "#{name}-#{version}" full_name += "-#{platform}" if platform != "ruby" - Marshal.load(Gem.inflate(File.open(gem_repo.join("quick/Marshal.4.8/#{full_name}.gemspec.rz")).read)) + Marshal.load(Gem::Util.inflate(File.open(gem_repo.join("quick/Marshal.4.8/#{full_name}.gemspec.rz")).read)) end end