| 1 | # Copyright 1999-2009 Gentoo Foundation |
1 | # Copyright 1999-2009 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.4 2009/12/15 17:43:51 flameeyes Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.5 2009/12/16 09:51:30 flameeyes Exp $ |
| 4 | # |
4 | # |
| 5 | # @ECLASS: ruby-fakegem.eclass |
5 | # @ECLASS: ruby-fakegem.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Ruby herd <ruby@gentoo.org> |
7 | # Ruby herd <ruby@gentoo.org> |
| 8 | # |
8 | # |
| … | |
… | |
| 149 | # path defaults to /usr/bin/$command |
149 | # path defaults to /usr/bin/$command |
| 150 | ruby_fakegem_binwrapper() { |
150 | ruby_fakegem_binwrapper() { |
| 151 | ( |
151 | ( |
| 152 | local gembinary=$1 |
152 | local gembinary=$1 |
| 153 | local newbinary=${2:-/usr/bin/$gembinary} |
153 | local newbinary=${2:-/usr/bin/$gembinary} |
|
|
154 | local relativegembinary=${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin/${gembinary} |
| 154 | |
155 | |
| 155 | cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF |
156 | cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF |
| 156 | #!/usr/bin/env ruby |
157 | #!/usr/bin/env ruby |
| 157 | # This is a simplified version of the RubyGems wrapper |
158 | # This is a simplified version of the RubyGems wrapper |
| 158 | # |
159 | # |
| 159 | # Generated by ruby-fakegem.eclass |
160 | # Generated by ruby-fakegem.eclass |
| 160 | |
161 | |
| 161 | require 'rubygems' |
162 | require 'rubygems' |
| 162 | |
163 | |
| 163 | load Gem::GemPathSearcher.new.find('$(tr [A-Z] [a-z] <<< ${RUBY_FAKEGEM_NAME})').full_gem_path + "/bin/${gembinary}" |
164 | load Gem::default_path[-1] + "/gems/${relativegembinary}" |
| 164 | |
165 | |
| 165 | EOF |
166 | EOF |
| 166 | |
167 | |
| 167 | exeinto $(dirname $newbinary) |
168 | exeinto $(dirname $newbinary) |
| 168 | newexe "${T}"/gembin-wrapper-${gembinary} $(basename $newbinary) |
169 | newexe "${T}"/gembin-wrapper-${gembinary} $(basename $newbinary) |