/[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.2 Revision 1.6
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.2 2009/12/15 15:32:27 flameeyes Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.6 2009/12/20 23:39:43 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#
16# providing integration into the RubyGems system even for "regular" packages. 16# providing integration into the RubyGems system even for "regular" packages.
17# 17#
18 18
19inherit ruby-ng 19inherit ruby-ng
20 20
21SRC_URI="mirror://rubygems/${P}.gem"
22
23# @ECLASS-VARIABLE: RUBY_FAKEGEM_NAME 21# @ECLASS-VARIABLE: RUBY_FAKEGEM_NAME
24# @DESCRIPTION: 22# @DESCRIPTION:
25# Sets the Gem name for the generated fake gemspec. 23# Sets the Gem name for the generated fake gemspec.
26# RUBY_FAKEGEM_NAME="${PN}" 24# RUBY_FAKEGEM_NAME="${PN}"
27 25
31# RUBY_FAKEGEM_VERSION="${PV}" 29# RUBY_FAKEGEM_VERSION="${PV}"
32 30
33# @ECLASS-VARIABLE: RUBY_FAKEGEM_TASK_DOC 31# @ECLASS-VARIABLE: RUBY_FAKEGEM_TASK_DOC
34# @DESCRIPTION: 32# @DESCRIPTION:
35# Specify the rake(1) task to run to generate documentation. 33# Specify the rake(1) task to run to generate documentation.
36# RUBY_FAKEGEM_VERSION="rdoc" 34# RUBY_FAKEGEM_TASK_DOC="rdoc"
37 35
38# @ECLASS-VARIABLE: RUBY_FAKEGEM_TASK_TEST 36# @ECLASS-VARIABLE: RUBY_FAKEGEM_TASK_TEST
39# @DESCRIPTION: 37# @DESCRIPTION:
40# Specify the rake(1) task used for executing tests. 38# Specify the rake(1) task used for executing tests.
41# RUBY_FAKEGEM_VERSION="test" 39# RUBY_FAKEGEM_TASK_TEST="test"
40
41# @ECLASS-VARIABLE: RUBY_FAKEGEM_DOCDIR
42# @DESCRIPTION:
43# Specify the directory under which the documentation is built;
44# if empty no documentation will be installed automatically.
45# RUBY_FAKEGEM_DOCDIR=""
46
47# @ECLASS-VARIABLE: RUBY_FAKEGEM_EXTRADOC
48# @DESCRIPTION:
49# Extra documentation to install (readme, changelogs, …).
50# RUBY_FAKEGEM_EXTRADOC=""
51
52# @ECLASS-VARIABLE: RUBY_FAKEGEM_BINWRAP
53# @DESCRIPTION:
54# Binaries to wrap around (relative to the bin/ directory)
55# RUBY_FAKEGEM_BINWRAP="*"
42 56
43RUBY_FAKEGEM_NAME="${RUBY_FAKEGEM_NAME:-${PN}}" 57RUBY_FAKEGEM_NAME="${RUBY_FAKEGEM_NAME:-${PN}}"
44RUBY_FAKEGEM_VERSION="${RUBY_FAKEGEM_VERSION:-${PV}}" 58RUBY_FAKEGEM_VERSION="${RUBY_FAKEGEM_VERSION:-${PV}}"
45 59
46RUBY_FAKEGEM_TASK_DOC="${RUBY_FAKEGEM_TASK_DOC-rdoc}" 60RUBY_FAKEGEM_TASK_DOC="${RUBY_FAKEGEM_TASK_DOC-rdoc}"
47RUBY_FAKEGEM_TASK_TEST="${RUBY_FAKEGEM_TASK_TEST-test}" 61RUBY_FAKEGEM_TASK_TEST="${RUBY_FAKEGEM_TASK_TEST-test}"
62
63RUBY_FAKEGEM_BINWRAP="${RUBY_FAKEGEM_BINWRAP-*}"
48 64
49if [[ ${RUBY_FAKEGEM_TASK_DOC} != "" ]]; then 65if [[ ${RUBY_FAKEGEM_TASK_DOC} != "" ]]; then
50 IUSE="$IUSE doc" 66 IUSE="$IUSE doc"
51 ruby_add_bdepend doc "dev-ruby/rake" 67 ruby_add_bdepend doc "dev-ruby/rake"
52fi 68fi
53 69
54if [[ ${RUBY_FAKEGEM_TASK_TEST} != "" ]]; then 70if [[ ${RUBY_FAKEGEM_TASK_TEST} != "" ]]; then
55 IUSE="$IUSE test" 71 IUSE="$IUSE test"
56 ruby_add_bdepend test "dev-ruby/rake" 72 ruby_add_bdepend test "dev-ruby/rake"
57fi 73fi
74
75SRC_URI="mirror://rubygems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}.gem"
58 76
59ruby_add_rdepend virtual/rubygems 77ruby_add_rdepend virtual/rubygems
60 78
61# @FUNCTION: ruby_fakegem_gemsdir 79# @FUNCTION: ruby_fakegem_gemsdir
62# @RETURN: Returns the gem data directory 80# @RETURN: Returns the gem data directory
138# path defaults to /usr/bin/$command 156# path defaults to /usr/bin/$command
139ruby_fakegem_binwrapper() { 157ruby_fakegem_binwrapper() {
140 ( 158 (
141 local gembinary=$1 159 local gembinary=$1
142 local newbinary=${2:-/usr/bin/$gembinary} 160 local newbinary=${2:-/usr/bin/$gembinary}
161 local relativegembinary=${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin/${gembinary}
143 162
144 cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF 163 cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF
145#!/usr/bin/env ruby 164#!/usr/bin/env ruby
146# This is a simplified version of the RubyGems wrapper 165# This is a simplified version of the RubyGems wrapper
147# 166#
148# Generated by ruby-fakegem.eclass 167# Generated by ruby-fakegem.eclass
149 168
150require 'rubygems' 169require 'rubygems'
151 170
152load Gem::GemPathSearcher.new.find('$(tr [A-Z] [a-z] <<< ${RUBY_FAKEGEM_NAME})').full_gem_path + "/bin/${gembinary}" 171load Gem::default_path[-1] + "/gems/${relativegembinary}"
153 172
154EOF 173EOF
155 174
156 exeinto $(dirname $newbinary) 175 exeinto $(dirname $newbinary)
157 newexe "${T}"/gembin-wrapper-${gembinary} $(basename $newbinary) 176 newexe "${T}"/gembin-wrapper-${gembinary} $(basename $newbinary)
254 fi 273 fi
255 274
256 if [[ -n ${RUBY_FAKEGEM_EXTRADOC} ]]; then 275 if [[ -n ${RUBY_FAKEGEM_EXTRADOC} ]]; then
257 dodoc ${RUBY_FAKEGEM_EXTRADOC} || die "failed to install further documentation" 276 dodoc ${RUBY_FAKEGEM_EXTRADOC} || die "failed to install further documentation"
258 fi 277 fi
278
279 # binary wrappers; we assume that all the implementations get the
280 # same binaries, or something is wrong anyway, so...
281 if [[ -n ${RUBY_FAKEGEM_BINWRAP} ]]; then
282 local bindir=$(find "${D}" -type d -path "*/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin" -print -quit)
283
284 if [[ -d "${bindir}" ]]; then
285 pushd "${bindir}"
286 local binaries=$(eval ls ${RUBY_FAKEGEM_BINWRAP})
287 for binary in $binaries; do
288 ruby_fakegem_binwrapper $binary
289 done
290 popd
291 fi
292 fi
259} 293}
260 294
261# @FUNCTION: all_ruby_install 295# @FUNCTION: all_ruby_install
262# @DESCRIPTION: 296# @DESCRIPTION:
263# Install files common to all ruby targets. 297# Install files common to all ruby targets.

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.20