Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-updates-src > by-pkgid > 41cc7d3984fa55dc9625367cb19ffe11 > files > 5

ruby-RubyGems-2.4.8-7.1.mga6.src.rpm

--- rubygems-2.4.8/lib/rubygems/basic_specification.rb.orig	2015-06-08 20:53:40.000000000 +0300
+++ rubygems-2.4.8/lib/rubygems/basic_specification.rb	2015-10-21 17:57:05.350164749 +0300
@@ -73,9 +73,15 @@
 
       suffixes = Gem.suffixes
 
+      ext      = full_gem_ext_path
+
       full_require_paths.any? do |dir|
-        base = "#{dir}/#{file}"
-        suffixes.any? { |suf| File.file? "#{base}#{suf}" }
+        base = ["#{dir}/#{file}"]
+        base << "#{ext}/#{dir}/#{file}" unless !ext || ext.empty?
+
+        base.any? do |path|
+          suffixes.any? { |suf| File.file? "#{path}#{suf}" }
+        end
       end
     end ? :yes : :no
     @contains_requirable_file[file] == :yes
@@ -102,6 +108,14 @@
                 Gem.extension_api_version)
   end
 
+  ##
+  # Returns the full path to the exts directory containing this spec's
+  # gem directory. eg: /usr/local/lib/ruby/1.8/exts
+
+  def exts_dir
+    @exts_dir ||= Gem.default_ext_dir_for(base_dir) || gems_dir
+  end
+
   def find_full_gem_path # :nodoc:
     # TODO: also, shouldn't it default to full_name if it hasn't been written?
     path = File.expand_path File.join(gems_dir, full_name)
@@ -111,6 +125,15 @@
 
   private :find_full_gem_path
 
+  def find_full_gem_ext_path # :nodoc:
+    # TODO: skip for gems without extensions.
+    path = File.expand_path File.join(exts_dir, full_name)
+    path.untaint
+    path if File.directory? path
+  end
+
+  private :find_full_gem_ext_path
+
   ##
   # The full path to the gem (install path + full name).
 
@@ -121,6 +144,13 @@
   end
 
   ##
+  # The full path to the gem binary extension (install path + full name).
+
+  def full_gem_ext_path
+    @full_gem_ext_path ||= find_full_gem_ext_path
+  end
+
+  ##
   # Returns the full name (name-version) of this Gem.  Platform information
   # is included (name-version-platform) if it is specified and not the
   # default Ruby platform.
--- rubygems-2.4.8/lib/rubygems/specification.rb.orig	2015-06-08 20:53:41.000000000 +0300
+++ rubygems-2.4.8/lib/rubygems/specification.rb	2015-10-21 17:54:56.974224306 +0300
@@ -1369,6 +1369,8 @@
 
     paths = full_require_paths
 
+    paths << File.join(ext_dir, require_paths.first) unless extensions.empty? || (ext_dir == full_gem_path)
+
     # gem directories must come after -I and ENV['RUBYLIB']
     insert_index = Gem.load_path_insert_index
 
@@ -1708,6 +1710,13 @@
     @executables = Array(value)
   end
 
+  # Returns the full path to this spec's ext directory.
+  # eg: /usr/local/lib/ruby/1.8/exts/mygem-1.0
+
+  def ext_dir
+    @ext_dir ||= File.expand_path File.join(exts_dir, full_name)
+  end
+
   ##
   # Sets extensions to +extensions+, ensuring it is an array. Don't
   # use this, push onto the array instead.