Package: ruby-inline / 3.12.4-1

dont_require_rubygems Patch series | download
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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

Index: ruby-inline/lib/inline.rb
===================================================================
--- ruby-inline.orig/lib/inline.rb	2013-10-01 12:23:41.000000000 -0500
+++ ruby-inline/lib/inline.rb	2013-10-01 12:28:05.000000000 -0500
@@ -50,7 +50,7 @@
 require "rbconfig"
 require "digest/md5"
 require 'fileutils'
-require 'rubygems'
+#require 'rubygems'
 
 require 'zentest_mapping'
 
@@ -71,11 +71,13 @@
   RUBINIUS = defined? RUBY_ENGINE
   DEV_NULL = (WINDOZE ? 'nul'      : '/dev/null')
   GEM      = 'gem'
-  RAKE     = if RUBINIUS then
-               File.join(Gem.bindir, 'rake')
-             else
-               "#{Gem.ruby} -S rake"
-             end
+  # RAKE     = if RUBINIUS then
+  #              File.join(Gem.bindir, 'rake')
+  #            else
+  #              "#{Gem.ruby} -S rake"
+  #            end
+  require 'rbconfig'
+  RAKE = '%s -S rake' % File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["RUBY_INSTALL_NAME"])
 
   warn "RubyInline v #{VERSION}" if $DEBUG
 
@@ -133,7 +135,18 @@
 
   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
Index: ruby-inline/test/test_inline.rb
===================================================================
--- ruby-inline.orig/test/test_inline.rb	2013-10-01 12:23:41.000000000 -0500
+++ ruby-inline/test/test_inline.rb	2013-10-01 12:23:41.000000000 -0500
@@ -71,7 +71,18 @@
   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