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

Commit

Permalink
Merge #7043
Browse files Browse the repository at this point in the history
7043: Remove old rubygems compatibility code r=bronzdoc a=deivid-rodriguez

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

The problem was that I was unsure where I needed to add the compatibility layer to #6963, and it took me a bit to scan through the compatibility file and figure it out.

### What was your diagnosis of the problem?

My diagnosis was that all this compatibility code is unused but makes this file harder to understand and scan through.

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

My fix is to remove the code.

### Why did you choose this fix out of the possible options?

I chose this fix because we can do it, I think.

Co-authored-by: David Rodríguez <[email protected]>
  • Loading branch information
bundlerbot and deivid-rodriguez committed Apr 14, 2019
2 parents 0a20c21 + 57b06c0 commit b165ba2
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 349 deletions.
29 changes: 7 additions & 22 deletions lib/bundler/rubygems_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,25 @@

require "rubygems/specification"

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
nil
end
# Possible use in Gem::Specification#source below and require
# shouldn't be deferred.
require "rubygems/source"

require "bundler/match_platform"

module Gem
@loaded_stacks = Hash.new {|h, k| h[k] = [] }

class Specification
attr_accessor :remote, :location, :relative_loaded_from

if instance_methods(false).include?(:source)
remove_method :source
attr_writer :source
def source
(defined?(@source) && @source) || Gem::Source::Installed.new
end
else
# rubocop:disable Lint/DuplicateMethods
attr_accessor :source
# rubocop:enable Lint/DuplicateMethods
remove_method :source
attr_writer :source
def source
(defined?(@source) && @source) || Gem::Source::Installed.new
end

alias_method :rg_full_gem_path, :full_gem_path
alias_method :rg_loaded_from, :loaded_from

attr_writer :full_gem_path unless instance_methods.include?(:full_gem_path=)

def full_gem_path
# this cannot check source.is_a?(Bundler::Plugin::API::Source)
# because that _could_ trip the autoload, and if there are unresolved
Expand Down
Loading

0 comments on commit b165ba2

Please sign in to comment.