Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #6314 - bundler:update-deprecated-methods, r=hsbt
Browse files Browse the repository at this point in the history
Use Gem::Util.inflate instead of Gem.inflate

### What was the end-user problem that led to this PR?

When  I released RubyGems 3.0, users can not use bundler with it.

### What was your diagnosis of the problem?

bundler still uses deprecated methods with rubygems/rubygems#2214

### What is your fix for the problem, implemented in this PR?

Replace `Gem.inflate` to `Gem::Util.inflate`
  • Loading branch information
bundlerbot committed Mar 1, 2018
2 parents c4fc79a + 9448fc8 commit ba63d2e
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/bundler/fetcher.rb
Expand Up @@ -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" \
Expand Down
4 changes: 2 additions & 2 deletions lib/bundler/fetcher/index.rb
Expand Up @@ -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" \
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/rubygems_integration.rb
Expand Up @@ -132,7 +132,7 @@ def read_binary(path)
end

def inflate(obj)
Gem.inflate(obj)
Gem::Util.inflate(obj)
end

def sources=(val)
Expand Down
2 changes: 1 addition & 1 deletion spec/install/gems/resolving_spec.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/support/artifice/compact_index.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/support/artifice/endpoint.rb
Expand Up @@ -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

Expand Down

0 comments on commit ba63d2e

Please sign in to comment.