Author: Gunnar Wolf <gwolf@debian.org>
Forwarded: Not-needed
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=658889
Last-Update: 2012-02-06
Applied-upstream: no
Description: Calls to Rubygems not allowed within the Debian archive
 This module still had some RubyGems calls - This patch replaces them
 with the proper location, according to the Debian Ruby policy

--- a/lib/inline.rb
+++ b/lib/inline.rb
@@ -50,7 +50,7 @@
 require "rbconfig"
 require "digest/md5"
 require 'fileutils'
-require 'rubygems'
+#require 'rubygems'
 
 require 'zentest_mapping'
 
@@ -70,7 +70,8 @@ module Inline
   WINDOZE  = /mswin|mingw/ =~ RUBY_PLATFORM
   DEV_NULL = (WINDOZE ? 'nul'      : '/dev/null')
   GEM      = 'gem'
-  RAKE     = "#{Gem.ruby} -S rake"
+  require 'rbconfig'
+  RAKE     = '%s -S rake' % File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["RUBY_INSTALL_NAME"])
 
   warn "RubyInline v #{VERSION}" if $DEBUG
 
@@ -131,7 +132,18 @@ module Inline
 
   def self.directory
     unless defined? @@directory then
-      version = "#{Gem.ruby_engine}-#{RbConfig::CONFIG['ruby_version']}"
+      # This version requires Rubygems - Work around it
+      # version = "#{Gem.ruby_engine}-#{RbConfig::CONFIG['ruby_version']}"
+      engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
+      rubyver = case RUBY_VERSION
+                when /^1\.9/
+                  '1.9.1'
+                when /^1\.8/
+                  '1.8'
+                else
+                  RUBY_VERSION
+                end
+      version = "#{engine}-#{rubyver}"
 
       @@directory = File.join(self.rootdir, ".ruby_inline", version)
     end
--- a/test/test_inline.rb
+++ b/test/test_inline.rb
@@ -73,7 +73,18 @@ class TestInline < InlineTestCase
   end
 
   def test_directory
-    version = "#{Gem.ruby_engine}-#{RbConfig::CONFIG['ruby_version']}"
+    # This version requires Rubygems - Work around it
+    # version = "#{Gem.ruby_engine}-#{RbConfig::CONFIG['ruby_version']}"
+    engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
+    rubyver = case RUBY_VERSION
+              when /^1\.9/
+                '1.9.1'
+              when /^1\.8/
+                '1.8'
+              else
+                RUBY_VERSION
+              end
+    version = "#{engine}-#{rubyver}"
     inlinedir = File.join(@rootdir, ".ruby_inline", version)
     assert_equal(inlinedir, Inline.directory)
   end
