/[gentoo-x86]/eclass/ruby-fakegem.eclass
Gentoo

Diff of /eclass/ruby-fakegem.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.10 Revision 1.13
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.10 2010/01/09 21:16:37 flameeyes Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.13 2010/01/24 00:00:40 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#
168ruby_fakegem_binwrapper() { 168ruby_fakegem_binwrapper() {
169 ( 169 (
170 local gembinary=$1 170 local gembinary=$1
171 local newbinary=${2:-/usr/bin/$gembinary} 171 local newbinary=${2:-/usr/bin/$gembinary}
172 local relativegembinary=${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin/${gembinary} 172 local relativegembinary=${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin/${gembinary}
173 local binpath=$(dirname $newbinary)
174 [[ ${binpath} = . ]] && binpath=/usr/bin
173 175
174 cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF 176 cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF
175#!/usr/bin/env ruby 177#!/usr/bin/env ruby
176# This is a simplified version of the RubyGems wrapper 178# This is a simplified version of the RubyGems wrapper
177# 179#
181 183
182load Gem::default_path[-1] + "/gems/${relativegembinary}" 184load Gem::default_path[-1] + "/gems/${relativegembinary}"
183 185
184EOF 186EOF
185 187
186 exeinto $(dirname $newbinary) 188 exeinto ${binpath:-/usr/bin}
187 newexe "${T}"/gembin-wrapper-${gembinary} $(basename $newbinary) 189 newexe "${T}"/gembin-wrapper-${gembinary} $(basename $newbinary)
188 ) || die "Unable to create fakegem wrapper" 190 ) || die "Unable to create fakegem wrapper"
189} 191}
190 192
191# @FUNCTION: all_fakegem_compile 193# @FUNCTION: all_fakegem_compile
213 ebegin "Unpacking .gem file..." 215 ebegin "Unpacking .gem file..."
214 tar -mxf ${DISTDIR}/${A} || die 216 tar -mxf ${DISTDIR}/${A} || die
215 eend $? 217 eend $?
216 218
217 mkdir "${S}" 219 mkdir "${S}"
218 pushd "${S}" 220 pushd "${S}" &>/dev/null
219 221
220 ebegin "Unpacking data.tar.gz" 222 ebegin "Unpacking data.tar.gz"
221 tar -mxf "${my_WORKDIR}"/data.tar.gz || die 223 tar -mxf "${my_WORKDIR}"/data.tar.gz || die
222 eend $? 224 eend $?
225 popd &>/dev/null
223 else 226 else
224 [[ -n ${A} ]] && unpack ${A} 227 [[ -n ${A} ]] && unpack ${A}
225 fi 228 fi
226} 229}
227 230
235# @FUNCTION: each_fakegem_test 238# @FUNCTION: each_fakegem_test
236# @DESCRIPTION: 239# @DESCRIPTION:
237# Run tests for the package for each ruby target if the test task is defined. 240# Run tests for the package for each ruby target if the test task is defined.
238each_fakegem_test() { 241each_fakegem_test() {
239 local rubyflags= 242 local rubyflags=
240
241 if [[ ${RUBY_FAKEGEM_TASK_TEST} != "" ]]; then
242 ${RUBY} ${rubyflags} -S rake ${RUBY_FAKEGEM_TASK_TEST} || die "tests failed" 243 ${RUBY} ${rubyflags} -S rake ${RUBY_FAKEGEM_TASK_TEST} || die "tests failed"
243 else
244 echo "No test task defined, skipping tests."
245 fi
246} 244}
247 245
246if [[ ${RUBY_FAKEGEM_TASK_TEST} != "" ]]; then
248# @FUNCTION: each_ruby_test 247 # @FUNCTION: each_ruby_test
249# @DESCRIPTION: 248 # @DESCRIPTION:
250# Run the tests for this package. 249 # Run the tests for this package.
251each_ruby_test() { 250 each_ruby_test() {
252 each_fakegem_test 251 each_fakegem_test
253} 252 }
253fi
254 254
255# @FUNCTION: each_fakegem_install 255# @FUNCTION: each_fakegem_install
256# @DESCRIPTION: 256# @DESCRIPTION:
257# Install the package for each ruby target. 257# Install the package for each ruby target.
258each_fakegem_install() { 258each_fakegem_install() {
259 ruby_fakegem_genspec 259 ruby_fakegem_genspec
260 260
261 local _gemlibdirs= 261 local _gemlibdirs="${RUBY_FAKEGEM_EXTRAINSTALL}"
262 for directory in bin lib ${RUBY_FAKEGEM_EXTRAINSTALL}; do 262 for directory in bin lib; do
263 [[ -d ${directory} ]] && _gemlibdirs="${_gemlibdirs} ${directory}" 263 [[ -d ${directory} ]] && _gemlibdirs="${_gemlibdirs} ${directory}"
264 done 264 done
265 265
266 [[ -n ${_gemlibdirs} ]] && \ 266 [[ -n ${_gemlibdirs} ]] && \
267 ruby_fakegem_doins -r ${_gemlibdirs} 267 ruby_fakegem_doins -r ${_gemlibdirs}
278# @DESCRIPTION: 278# @DESCRIPTION:
279# Install files common to all ruby targets. 279# Install files common to all ruby targets.
280all_fakegem_install() { 280all_fakegem_install() {
281 if [[ -n ${RUBY_FAKEGEM_DOCDIR} ]] && [[ ${RUBY_FAKEGEM_TASK_DOC} != "" ]] && use doc; then 281 if [[ -n ${RUBY_FAKEGEM_DOCDIR} ]] && [[ ${RUBY_FAKEGEM_TASK_DOC} != "" ]] && use doc; then
282 for dir in ${RUBY_FAKEGEM_DOCDIR}; do 282 for dir in ${RUBY_FAKEGEM_DOCDIR}; do
283 pushd ${dir} 283 pushd ${dir} &>/dev/null
284 dohtml -r * || die "failed to install documentation" 284 dohtml -r * || die "failed to install documentation"
285 popd 285 popd &>/dev/null
286 done 286 done
287 fi 287 fi
288 288
289 if [[ -n ${RUBY_FAKEGEM_EXTRADOC} ]]; then 289 if [[ -n ${RUBY_FAKEGEM_EXTRADOC} ]]; then
290 dodoc ${RUBY_FAKEGEM_EXTRADOC} || die "failed to install further documentation" 290 dodoc ${RUBY_FAKEGEM_EXTRADOC} || die "failed to install further documentation"
294 # same binaries, or something is wrong anyway, so... 294 # same binaries, or something is wrong anyway, so...
295 if [[ -n ${RUBY_FAKEGEM_BINWRAP} ]]; then 295 if [[ -n ${RUBY_FAKEGEM_BINWRAP} ]]; then
296 local bindir=$(find "${D}" -type d -path "*/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin" -print -quit) 296 local bindir=$(find "${D}" -type d -path "*/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin" -print -quit)
297 297
298 if [[ -d "${bindir}" ]]; then 298 if [[ -d "${bindir}" ]]; then
299 pushd "${bindir}" 299 pushd "${bindir}" &>/dev/null
300 local binaries=$(eval ls ${RUBY_FAKEGEM_BINWRAP}) 300 local binaries=$(eval ls ${RUBY_FAKEGEM_BINWRAP})
301 for binary in $binaries; do 301 for binary in $binaries; do
302 ruby_fakegem_binwrapper $binary 302 ruby_fakegem_binwrapper $binary
303 done 303 done
304 popd 304 popd &>/dev/null
305 fi 305 fi
306 fi 306 fi
307} 307}
308 308
309# @FUNCTION: all_ruby_install 309# @FUNCTION: all_ruby_install

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.13

  ViewVC Help
Powered by ViewVC 1.1.20