Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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