[DRE-commits] r4409 - in trunk/libinline-ruby/debian: . patches

Tobias Grimm tiber-guest at alioth.debian.org
Sun Dec 6 01:48:58 UTC 2009


Author: tiber-guest
Date: 2009-12-06 01:48:58 +0000 (Sun, 06 Dec 2009)
New Revision: 4409

Added:
   trunk/libinline-ruby/debian/inline_method_name_mapping.rb
   trunk/libinline-ruby/debian/patches/02-replace-ZenTestMapping.patch
Modified:
   trunk/libinline-ruby/debian/changelog
   trunk/libinline-ruby/debian/libinline-ruby1.8.install
   trunk/libinline-ruby/debian/patches/01-dont-requires-rubygems.patch
   trunk/libinline-ruby/debian/patches/series
   trunk/libinline-ruby/debian/rules
Log:
* Run unit tests at build time
* Replaced ZenTestMapping usage with custom implementation of the method
  name mapping

Modified: trunk/libinline-ruby/debian/changelog
===================================================================
--- trunk/libinline-ruby/debian/changelog	2009-12-05 20:14:50 UTC (rev 4408)
+++ trunk/libinline-ruby/debian/changelog	2009-12-06 01:48:58 UTC (rev 4409)
@@ -2,6 +2,9 @@
 
   * Removed remaining unnecessary Gem usage (Closes: #557534)
   * Add myself to Uploaders
+  * Run unit tests at build time
+  * Replaced ZenTestMapping usage with custom implementation of the method
+    name mapping
 
  -- Tobias Grimm <etobi at debian.org>  Sat, 05 Dec 2009 21:13:20 +0100
 

Added: trunk/libinline-ruby/debian/inline_method_name_mapping.rb
===================================================================
--- trunk/libinline-ruby/debian/inline_method_name_mapping.rb	                        (rev 0)
+++ trunk/libinline-ruby/debian/inline_method_name_mapping.rb	2009-12-06 01:48:58 UTC (rev 4409)
@@ -0,0 +1,48 @@
+module MethodNameMapping
+  @@method_map = {
+    'bang'         => '!',
+    'percent'      => '%',
+    'and'          => '&',
+    'times'        => '*',
+    'times2'       => '**',
+    'plus'         => '+',
+    'minus'        => '-',
+    'div'          => '/',
+    'lt'           => '<',
+    'lte'          => '<=',
+    'spaceship'    => '<=>',
+    'lt2'          => '<<',
+    'equals2'      => '==',
+    'equals3'      => '===',
+    'equalstilde'  => '=~',
+    'gt'           => '>',
+    'ge'           => '>=',
+    'gt2'          => '>>',
+    'unary_plus'   => '+@',
+    'unary_minus'  => '-@',
+    'index'        => '[]',
+    'index_equals' => '[]=',
+    'carat'        => '^',
+    'or'           => '|',
+    'tilde'        => '~',
+  }
+
+  @@mapped_re = @@method_map.values.map {|s| Regexp.escape(s)}.join("|")
+
+  def to_ruby(name)
+    name = name.to_s.dup
+    is_class_method = name.sub!(/^class_/, '')
+
+    if @@method_map.has_key?(name)
+      name=@@method_map[name]
+    elsif name.sub!(/_equals(_.*)?$/, '=')
+    elsif name.sub!(/_bang(_.*)?$/, '!')
+    elsif name.sub!(/_eh(_.*)?$/, '?')
+    elsif name =~ /(.*?)_/ and @@method_map.has_key? $1
+      name = @@method_map[$1]
+    end
+    name = 'self.' + name if is_class_method
+
+    return name
+  end
+end

Modified: trunk/libinline-ruby/debian/libinline-ruby1.8.install
===================================================================
--- trunk/libinline-ruby/debian/libinline-ruby1.8.install	2009-12-05 20:14:50 UTC (rev 4408)
+++ trunk/libinline-ruby/debian/libinline-ruby1.8.install	2009-12-06 01:48:58 UTC (rev 4409)
@@ -1 +1,2 @@
-lib/inline.rb   usr/lib/ruby/1.8/
+lib/inline.rb                           usr/lib/ruby/1.8/
+debian/inline_method_name_mapping.rb    usr/lib/ruby/1.8/

Modified: trunk/libinline-ruby/debian/patches/01-dont-requires-rubygems.patch
===================================================================
--- trunk/libinline-ruby/debian/patches/01-dont-requires-rubygems.patch	2009-12-05 20:14:50 UTC (rev 4408)
+++ trunk/libinline-ruby/debian/patches/01-dont-requires-rubygems.patch	2009-12-06 01:48:58 UTC (rev 4409)
@@ -2,19 +2,17 @@
 
 Index: libinline-ruby-3.8.3/lib/inline.rb
 ===================================================================
---- libinline-ruby-3.8.3.orig/lib/inline.rb	2009-11-22 17:32:49.000000000 +0100
-+++ libinline-ruby-3.8.3/lib/inline.rb	2009-11-22 17:49:40.000000000 +0100
-@@ -50,9 +50,6 @@
+--- libinline-ruby-3.8.3.orig/lib/inline.rb	2009-12-06 00:50:06.000000000 +0100
++++ libinline-ruby-3.8.3/lib/inline.rb	2009-12-06 00:50:35.000000000 +0100
+@@ -50,7 +50,6 @@
  require "rbconfig"
  require "digest/md5"
  require 'fileutils'
 -require 'rubygems'
--
--require 'zentest_mapping'
  
- $TESTING = false unless defined? $TESTING
+ require 'zentest_mapping'
  
-@@ -71,13 +68,6 @@
+@@ -71,13 +70,6 @@
    RUBINIUS = defined? RUBY_ENGINE
    DEV_NULL = (WINDOZE ? 'nul'      : '/dev/null')
    GEM      = (WINDOZE ? 'gem.bat'  : 'gem')
@@ -28,21 +26,3 @@
  
    warn "RubyInline v #{VERSION}" if $DEBUG
  
-@@ -151,8 +141,6 @@
- 
-   class C
- 
--    include ZenTestMapping
--
-     MAGIC_ARITY_THRESHOLD = 15
-     MAGIC_ARITY = -1
- 
-@@ -245,7 +233,7 @@
-       signature = parse_signature(src, !expand_types)
-       function_name = signature['name']
-       method_name = options[:method_name]
--      method_name ||= test_to_normal function_name
-+      method_name ||= function_name
-       return_type = signature['return']
-       arity = signature['arity']
- 

Added: trunk/libinline-ruby/debian/patches/02-replace-ZenTestMapping.patch
===================================================================
--- trunk/libinline-ruby/debian/patches/02-replace-ZenTestMapping.patch	                        (rev 0)
+++ trunk/libinline-ruby/debian/patches/02-replace-ZenTestMapping.patch	2009-12-06 01:48:58 UTC (rev 4409)
@@ -0,0 +1,33 @@
+Replace ZenTestMapping with a custom implementation of the method name mapping
+
+Index: libinline-ruby-3.8.3/lib/inline.rb
+===================================================================
+--- libinline-ruby-3.8.3.orig/lib/inline.rb	2009-12-06 00:59:10.000000000 +0100
++++ libinline-ruby-3.8.3/lib/inline.rb	2009-12-06 01:00:06.000000000 +0100
+@@ -52,7 +52,7 @@
+ require 'fileutils'
+ require 'rubygems'
+ 
+-require 'zentest_mapping'
++require 'inline_method_name_mapping'
+ 
+ $TESTING = false unless defined? $TESTING
+ 
+@@ -151,7 +151,7 @@
+ 
+   class C
+ 
+-    include ZenTestMapping
++    include MethodNameMapping
+ 
+     MAGIC_ARITY_THRESHOLD = 15
+     MAGIC_ARITY = -1
+@@ -245,7 +245,7 @@
+       signature = parse_signature(src, !expand_types)
+       function_name = signature['name']
+       method_name = options[:method_name]
+-      method_name ||= test_to_normal function_name
++      method_name ||= to_ruby function_name
+       return_type = signature['return']
+       arity = signature['arity']
+ 

Modified: trunk/libinline-ruby/debian/patches/series
===================================================================
--- trunk/libinline-ruby/debian/patches/series	2009-12-05 20:14:50 UTC (rev 4408)
+++ trunk/libinline-ruby/debian/patches/series	2009-12-06 01:48:58 UTC (rev 4409)
@@ -1,2 +1,3 @@
 00-fix-shebang.patch
 01-dont-requires-rubygems.patch
+02-replace-ZenTestMapping.patch

Modified: trunk/libinline-ruby/debian/rules
===================================================================
--- trunk/libinline-ruby/debian/rules	2009-12-05 20:14:50 UTC (rev 4408)
+++ trunk/libinline-ruby/debian/rules	2009-12-06 01:48:58 UTC (rev 4409)
@@ -4,3 +4,12 @@
 
 include /usr/share/cdbs/1/rules/debhelper.mk
 include /usr/share/cdbs/1/rules/patchsys-quilt.mk
+
+build: build-stamp
+
+build-stamp:
+	# Run unit tests:
+	/usr/bin/ruby1.8 -w -Ilib -Idebian ./test/test_*.rb
+
+clean::
+	rm -f build-stamp




More information about the Pkg-ruby-extras-commits mailing list