/[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.27 Revision 1.32
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2011 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.27 2010/12/28 12:07:15 graaff Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.32 2011/12/05 12:24:33 graaff 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# @AUTHOR:
9# Author: Diego E. Pettenò <flameeyes@gentoo.org> 9# Author: Diego E. Pettenò <flameeyes@gentoo.org>
10#
11# Author: Alex Legler <a3li@gentoo.org> 10# Author: Alex Legler <a3li@gentoo.org>
12#
13# @BLURB: An eclass for installing Ruby packages to behave like RubyGems. 11# @BLURB: An eclass for installing Ruby packages to behave like RubyGems.
14# @DESCRIPTION: 12# @DESCRIPTION:
15# This eclass allows to install arbitrary Ruby libraries (including Gems), 13# This eclass allows to install arbitrary Ruby libraries (including Gems),
16# providing integration into the RubyGems system even for "regular" packages. 14# providing integration into the RubyGems system even for "regular" packages.
17#
18 15
19inherit ruby-ng 16inherit ruby-ng
20 17
21# @ECLASS-VARIABLE: RUBY_FAKEGEM_NAME 18# @ECLASS-VARIABLE: RUBY_FAKEGEM_NAME
22# @DESCRIPTION: 19# @DESCRIPTION:
61 58
62# @ECLASS-VARIABLE: RUBY_FAKEGEM_GEMSPEC 59# @ECLASS-VARIABLE: RUBY_FAKEGEM_GEMSPEC
63# @DESCRIPTION: 60# @DESCRIPTION:
64# Filename of .gemspec file to install instead of generating a generic one. 61# Filename of .gemspec file to install instead of generating a generic one.
65# RUBY_FAKEGEM_GEMSPEC="" 62# RUBY_FAKEGEM_GEMSPEC=""
63
64# @ECLASS-VARIABLE: RUBY_FAKEGEM_EXTRAINSTALL
65# @DESCRIPTION:
66# List of files and directories relative to the top directory that also
67# get installed. Some gems provide extra files such as version information,
68# Rails generators, or data that needs to be installed as well.
69# RUBY_FAKEGEM_EXTRAINSTALL=""
66 70
67RUBY_FAKEGEM_NAME="${RUBY_FAKEGEM_NAME:-${PN}}" 71RUBY_FAKEGEM_NAME="${RUBY_FAKEGEM_NAME:-${PN}}"
68RUBY_FAKEGEM_VERSION="${RUBY_FAKEGEM_VERSION:-${PV/_pre/.pre}}" 72RUBY_FAKEGEM_VERSION="${RUBY_FAKEGEM_VERSION:-${PV/_pre/.pre}}"
69RUBY_FAKEGEM_SUFFIX="${RUBY_FAKEGEM_SUFFIX:-}" 73RUBY_FAKEGEM_SUFFIX="${RUBY_FAKEGEM_SUFFIX:-}"
70 74
87 ruby_add_bdepend "test? ( dev-ruby/rake )" 91 ruby_add_bdepend "test? ( dev-ruby/rake )"
88fi 92fi
89 93
90SRC_URI="mirror://rubygems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}${RUBY_FAKEGEM_SUFFIX:+-${RUBY_FAKEGEM_SUFFIX}}.gem" 94SRC_URI="mirror://rubygems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}${RUBY_FAKEGEM_SUFFIX:+-${RUBY_FAKEGEM_SUFFIX}}.gem"
91 95
92ruby_add_bdepend dev-ruby/rubygems 96ruby_add_bdepend virtual/rubygems
93ruby_add_rdepend dev-ruby/rubygems 97ruby_add_rdepend virtual/rubygems
94 98
95# @FUNCTION: ruby_fakegem_gemsdir 99# @FUNCTION: ruby_fakegem_gemsdir
96# @RETURN: Returns the gem data directory 100# @RETURN: Returns the gem data directory
97# @DESCRIPTION: 101# @DESCRIPTION:
98# This function returns the gems data directory for the ruby 102# This function returns the gems data directory for the ruby
159 ruby_fakegem_metadata_gemspec ${metadata} ${gemspec} 163 ruby_fakegem_metadata_gemspec ${metadata} ${gemspec}
160 else 164 else
161 ruby_fakegem_genspec ${gemspec} 165 ruby_fakegem_genspec ${gemspec}
162 fi 166 fi
163 fi 167 fi
164 ) || "Unable to generate gemspec file." 168 ) || die "Unable to generate gemspec file."
165 169
166 insinto $(ruby_fakegem_gemsdir)/specifications 170 insinto $(ruby_fakegem_gemsdir)/specifications
167 newins ${gemspec} ${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}.gemspec || die "Unable to install gemspec file." 171 newins ${gemspec} ${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}.gemspec || die "Unable to install gemspec file."
168} 172}
169 173
210 # copies with different implementations; while for now we're using 214 # copies with different implementations; while for now we're using
211 # the same exact content, we might have differences in the future, 215 # the same exact content, we might have differences in the future,
212 # so better taking this into consideration. 216 # so better taking this into consideration.
213 local quoted_description=${DESCRIPTION//\"/\\\"} 217 local quoted_description=${DESCRIPTION//\"/\\\"}
214 cat - > $1 <<EOF 218 cat - > $1 <<EOF
215# generated by ruby-fakegem.eclass $Revision: 1.27 $ 219# generated by ruby-fakegem.eclass $Revision: 1.32 $
216Gem::Specification.new do |s| 220Gem::Specification.new do |s|
217 s.name = "${RUBY_FAKEGEM_NAME}" 221 s.name = "${RUBY_FAKEGEM_NAME}"
218 s.version = "${RUBY_FAKEGEM_VERSION}" 222 s.version = "${RUBY_FAKEGEM_VERSION}"
219 s.summary = "${quoted_description}" 223 s.summary = "${quoted_description}"
220 s.homepage = "${HOMEPAGE}" 224 s.homepage = "${HOMEPAGE}"
260 264
261 cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF 265 cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF
262#!${rubycmd} 266#!${rubycmd}
263# This is a simplified version of the RubyGems wrapper 267# This is a simplified version of the RubyGems wrapper
264# 268#
265# Generated by ruby-fakegem.eclass $Revision: 1.27 $ 269# Generated by ruby-fakegem.eclass $Revision: 1.32 $
266 270
267require 'rubygems' 271require 'rubygems'
268 272
269load Gem::default_path[-1] + "/gems/${relativegembinary}" 273load Gem::default_path[-1] + "/gems/${relativegembinary}"
270 274
293 # extracted twice and the mtime from the archive _has_ to be 297 # extracted twice and the mtime from the archive _has_ to be
294 # ignored (it's always set to epoch 0). 298 # ignored (it's always set to epoch 0).
295 for archive in ${A}; do 299 for archive in ${A}; do
296 case "${archive}" in 300 case "${archive}" in
297 *.gem) 301 *.gem)
298 # Make sure that we're not running unoack for more than 302 # Make sure that we're not running unpack for more than
299 # one .gem file, since we won't support that at all. 303 # one .gem file, since we won't support that at all.
300 [[ -d "${S}" ]] && die "Unable to unpack ${archive}, ${S} exists" 304 [[ -d "${S}" ]] && die "Unable to unpack ${archive}, ${S} exists"
301 305
302 ebegin "Unpacking .gem file..." 306 ebegin "Unpacking .gem file..."
303 tar -mxf ${DISTDIR}/${archive} || die 307 tar -mxf ${DISTDIR}/${archive} || die

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.32

  ViewVC Help
Powered by ViewVC 1.1.20