/usr/lib/ruby/1.8/extlib/rubygems.rb is in libextlib-ruby1.8 0.9.13-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # this is a temporary workaround until rubygems Does the Right thing here
require 'rubygems'
module Gem
class SourceIndex
# This is resolved in 1.1
if Version.new(RubyGemsVersion) < Version.new("1.1")
# Overwrite this so that a gem of the same name and version won't push one
# from the gems directory out entirely.
#
# @param gem_spec<Gem::Specification> The specification of the gem to add.
def add_spec(gem_spec)
unless gem_spec.instance_variable_get("@loaded_from") &&
@gems[gem_spec.full_name].is_a?(Gem::Specification) &&
@gems[gem_spec.full_name].installation_path ==
File.join(defined?(Merb) && Merb.respond_to?(:root) ? Merb.root : Dir.pwd,"gems")
@gems[gem_spec.full_name] = gem_spec
end
end
end
end
class Specification
# Overwrite this so that gems in the gems directory get preferred over gems
# from any other location. If there are two gems of different versions in
# the gems directory, the later one will load as usual.
#
# @return <Array[Array]> The object used for sorting gem specs.
def sort_obj
[@name, installation_path == File.join(defined?(Merb) && Merb.respond_to?(:root) ? Merb.root : Dir.pwd,"gems") ? 1 : -1, @version.to_ints, @new_platform == Gem::Platform::RUBY ? -1 : 1]
end
end
end
|