Allow additional content to be injected in the ruby bin wrapper.
authorHans de Graaff <graaff@gentoo.org>
Sun, 7 Dec 2014 07:23:12 +0000 (07:23 +0000)
committerHans de Graaff <graaff@gentoo.org>
Sun, 7 Dec 2014 07:23:12 +0000 (07:23 +0000)
eclass/ChangeLog
eclass/ruby-fakegem.eclass

index 514c36e8f729fb2b994d802e39a617fb82cdead3..dd7fe1eb9cd0ed3f7d1f1942165c371d83d9f4b4 100644 (file)
@@ -1,6 +1,9 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1453 2014/12/04 10:32:10 mrueg Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1454 2014/12/07 07:23:12 graaff Exp $
+
+  07 Dec 2014; Hans de Graaff <graaff@gentoo.org> ruby-fakegem.eclass:
+  Allow additional content to be injected in the ruby bin wrapper.
 
   04 Dec 2014; Manuel RĂ¼ger <mrueg@gentoo.org> kde4-base.eclass:
   Sync kde4-base.eclass with overlay.
index 153c3fd7534a56929389ee9160ec2f28869f7811..3ed591e681fd8b6f849c3139876400033632ee6f 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.41 2014/04/21 07:35:43 graaff Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.42 2014/12/07 07:23:12 graaff Exp $
 
 # @ECLASS: ruby-fakegem.eclass
 # @MAINTAINER:
@@ -287,7 +287,7 @@ ruby_fakegem_genspec() {
        # so better taking this into consideration.
        local quoted_description=${DESCRIPTION//\"/\\\"}
        cat - > $1 <<EOF
-# generated by ruby-fakegem.eclass $Revision: 1.41 $
+# generated by ruby-fakegem.eclass $Revision: 1.42 $
 Gem::Specification.new do |s|
   s.name = "${RUBY_FAKEGEM_NAME}"
   s.version = "${RUBY_FAKEGEM_VERSION}"
@@ -299,14 +299,17 @@ EOF
 }
 
 # @FUNCTION: ruby_fakegem_binwrapper
-# @USAGE: command [path]
+# @USAGE: command [path] [content]
 # @DESCRIPTION:
 # Creates a new binary wrapper for a command installed by the RubyGem.
-# path defaults to /usr/bin/$command
+# path defaults to /usr/bin/$command content is optional and can be used
+# to inject additional ruby code into the wrapper. This may be useful to
+# e.g. force a specific version using the gem command.
 ruby_fakegem_binwrapper() {
        (
                local gembinary=$1
                local newbinary=${2:-/usr/bin/$gembinary}
+               local content=$3
                local relativegembinary=${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin/${gembinary}
                local binpath=$(dirname $newbinary)
                [[ ${binpath} = . ]] && binpath=/usr/bin
@@ -337,10 +340,11 @@ ruby_fakegem_binwrapper() {
 #!${rubycmd}
 # This is a simplified version of the RubyGems wrapper
 #
-# Generated by ruby-fakegem.eclass $Revision: 1.41 $
+# Generated by ruby-fakegem.eclass $Revision: 1.42 $
 
 require 'rubygems'
 
+${content}
 load Gem::default_path[-1] + "/gems/${relativegembinary}"
 
 EOF