| 1 |
# Copyright 1999-2005 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: Exp $
|
| 4 |
#
|
| 5 |
# Author: Rob Cakebread <pythonhead@gentoo.org>
|
| 6 |
# Current Maintainer: Rob Cakebread <pythonhead@gentoo.org>
|
| 7 |
#
|
| 8 |
# The gems eclass is designed to allow easier installation of
|
| 9 |
# gems-based ruby packagess and their incorporation into
|
| 10 |
# the Gentoo Linux system.
|
| 11 |
#
|
| 12 |
# - Features:
|
| 13 |
# gems_location() - Set ${GEMSDIR} with /usr/lib/ruby/gems/RUBY_MAJ_VER
|
| 14 |
# gems_src_install() - installs a gem into ${D}
|
| 15 |
# gems_src_test() - unpacks gem and runs rake if there is an appropriate test dir
|
| 16 |
|
| 17 |
|
| 18 |
inherit ruby eutils
|
| 19 |
|
| 20 |
ECLASS=gems
|
| 21 |
INHERITED="$INHERITED $ECLASS"
|
| 22 |
|
| 23 |
DEPEND=">=dev-ruby/rubygems-0.8.4-r1"
|
| 24 |
|
| 25 |
S=${WORKDIR}
|
| 26 |
|
| 27 |
|
| 28 |
gems_location() {
|
| 29 |
local sitelibdir
|
| 30 |
sitelibdir=`ruby -r rbconfig -e 'print Config::CONFIG["sitelibdir"]'`
|
| 31 |
export GEMSDIR=${sitelibdir/site_ruby/gems}
|
| 32 |
}
|
| 33 |
|
| 34 |
|
| 35 |
gems_src_unpack() {
|
| 36 |
true
|
| 37 |
}
|
| 38 |
|
| 39 |
|
| 40 |
gems_src_install() {
|
| 41 |
gems_location
|
| 42 |
dodir ${GEMSDIR}
|
| 43 |
gem install ${DISTDIR}/${P} -v ${PV} -l -i ${D}/${GEMSDIR} || die "gem install failed"
|
| 44 |
|
| 45 |
if [ -d ${D}/${GEMSDIR}/bin ] ; then
|
| 46 |
exeinto /usr/bin
|
| 47 |
for exe in ${D}/${GEMSDIR}/bin/* ; do
|
| 48 |
doexe ${exe}
|
| 49 |
done
|
| 50 |
fi
|
| 51 |
}
|
| 52 |
|
| 53 |
gems_src_compile() {
|
| 54 |
true
|
| 55 |
}
|
| 56 |
|
| 57 |
gems_src_test() {
|
| 58 |
if has_version 'dev-ruby/rake' ; then
|
| 59 |
cd ${WORKDIR}
|
| 60 |
tar xf ${DISTDIR}/${P}.gem >/dev/null 2>&1
|
| 61 |
tar xzf data.tar.gz >/dev/null 2>&1
|
| 62 |
if [ -d ${WORKDIR}/test ] ; then
|
| 63 |
cd ${WORKDIR}/test
|
| 64 |
rake
|
| 65 |
fi
|
| 66 |
else
|
| 67 |
einfo "You need dev-ruby/rake emerged to run this test"
|
| 68 |
fi
|
| 69 |
}
|
| 70 |
|
| 71 |
|
| 72 |
EXPORT_FUNCTIONS src_unpack src_compile src_install src_test
|
| 73 |
|