summaryrefslogtreecommitdiff
blob: c4ca039594fb7311d383baeef37ee8a6d99285e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gems.eclass,v 1.7 2005/09/23 00:57:25 caleb Exp $
#
# Author: Rob Cakebread <pythonhead@gentoo.org>
# Current Maintainer: Rob Cakebread <pythonhead@gentoo.org>
#
# The gems eclass is designed to allow easier installation of
# gems-based ruby packagess and their incorporation into
# the Gentoo Linux system.
#
# - Features:
# gems_location()     - Set ${GEMSDIR} with gem install dir and ${GEM_SRC} with path to gem to install
# gems_src_install()  - installs a gem into ${D}
# gems_src_unpack()   - Does nothing.
# gems_src_compile()  - Does nothing.
#
# NOTE:
# See http://dev.gentoo.org/~pythonhead/ruby/gems.html for notes on using gems with portage


inherit ruby eutils


DEPEND=">=dev-ruby/rubygems-0.8.4-r1
	!dev-ruby/rdoc"

S=${WORKDIR}


gems_location() {
	local sitelibdir
	sitelibdir=`ruby -r rbconfig -e 'print Config::CONFIG["sitelibdir"]'`
	export GEMSDIR=${sitelibdir/site_ruby/gems}

}

gems_src_unpack() {
	true
}

gems_src_install() {
	gems_location

	if [ -z "${MY_P}" ]; then
		GEM_SRC=${DISTDIR}/${P}
	else
		GEM_SRC=${DISTDIR}/${MY_P}
	fi

	dodir ${GEMSDIR}
	gem install ${GEM_SRC} -v ${PV} -l -i ${D}/${GEMSDIR} || die "gem install failed"

	if [ -d ${D}/${GEMSDIR}/bin ] ; then
		exeinto /usr/bin
		for exe in ${D}/${GEMSDIR}/bin/* ; do
			doexe ${exe}
		done
	fi
}

gems_src_compile() {
	true
}

EXPORT_FUNCTIONS src_unpack src_compile src_install