/[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.36 Revision 1.40
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2013 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.36 2012/08/15 15:06:09 flameeyes Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.40 2013/11/09 10:22:06 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# @AUTHOR: 8# @AUTHOR:
49# @ECLASS-VARIABLE: RUBY_FAKEGEM_RECIPE_DOC 49# @ECLASS-VARIABLE: RUBY_FAKEGEM_RECIPE_DOC
50# @DESCRIPTION: 50# @DESCRIPTION:
51# Specify one of the default API doc building function for ruby-fakegem: 51# Specify one of the default API doc building function for ruby-fakegem:
52# - rake (default; see also RUBY_FAKEGEM_TASK_DOC) 52# - rake (default; see also RUBY_FAKEGEM_TASK_DOC)
53# - rdoc (calls `rdoc-2`, adds dev-ruby/rdoc to the dependencies); 53# - rdoc (calls `rdoc-2`, adds dev-ruby/rdoc to the dependencies);
54# - yard (calls `yard`, adds dev-ruby/yard to the dependencies);
54# - none 55# - none
55# RUBY_FAKEGEM_RECIPE_DOC="rake" 56# RUBY_FAKEGEM_RECIPE_DOC="rake"
56 57
57# @ECLASS-VARIABLE: RUBY_FAKEGEM_DOCDIR 58# @ECLASS-VARIABLE: RUBY_FAKEGEM_DOCDIR
58# @DESCRIPTION: 59# @DESCRIPTION:
112 113
113case ${RUBY_FAKEGEM_RECIPE_DOC} in 114case ${RUBY_FAKEGEM_RECIPE_DOC} in
114 rake) 115 rake)
115 IUSE+=" doc" 116 IUSE+=" doc"
116 ruby_add_bdepend "doc? ( dev-ruby/rake )" 117 ruby_add_bdepend "doc? ( dev-ruby/rake )"
118 RUBY_FAKEGEM_DOCDIR="doc"
117 ;; 119 ;;
118 rdoc) 120 rdoc)
119 IUSE+=" doc" 121 IUSE+=" doc"
120 ruby_add_bdepend "doc? ( dev-ruby/rdoc )" 122 ruby_add_bdepend "doc? ( dev-ruby/rdoc )"
123 RUBY_FAKEGEM_DOCDIR="doc"
124 ;;
125 yard)
126 IUSE+="doc"
127 ruby_add_bdepend "doc? ( dev-ruby/yard )"
121 RUBY_FAKEGEM_DOCDIR="doc" 128 RUBY_FAKEGEM_DOCDIR="doc"
122 ;; 129 ;;
123 none) 130 none)
124 [[ -n ${RUBY_FAKEGEM_DOCDIR} ]] && IUSE+=" doc" 131 [[ -n ${RUBY_FAKEGEM_DOCDIR} ]] && IUSE+=" doc"
125 ;; 132 ;;
243# @DESCRIPTION: 250# @DESCRIPTION:
244# Generates an installable version of the specification indicated by 251# Generates an installable version of the specification indicated by
245# the metadata distributed by the gem itself. This is similar to how 252# the metadata distributed by the gem itself. This is similar to how
246# rubygems creates an installation from a .gem file. 253# rubygems creates an installation from a .gem file.
247ruby_fakegem_metadata_gemspec() { 254ruby_fakegem_metadata_gemspec() {
255 case ${RUBY} in
256 *ruby19)
257 ${RUBY} -r yaml -e "puts Gem::Specification.from_yaml(File::open('$1', :encoding => 'UTF-8').read).to_ruby" > $2
258 ;;
259 *)
248 ${RUBY} -r yaml -e "puts Gem::Specification.from_yaml(File::open('$1').read).to_ruby" > $2 260 ${RUBY} -r yaml -e "puts Gem::Specification.from_yaml(File::open('$1').read).to_ruby" > $2
261 ;;
262 esac
249} 263}
250 264
251# @FUNCTION: ruby_fakegem_genspec 265# @FUNCTION: ruby_fakegem_genspec
252# @USAGE: output-gemspec 266# @USAGE: output-gemspec
253# @DESCRIPTION: 267# @DESCRIPTION:
271 # copies with different implementations; while for now we're using 285 # copies with different implementations; while for now we're using
272 # the same exact content, we might have differences in the future, 286 # the same exact content, we might have differences in the future,
273 # so better taking this into consideration. 287 # so better taking this into consideration.
274 local quoted_description=${DESCRIPTION//\"/\\\"} 288 local quoted_description=${DESCRIPTION//\"/\\\"}
275 cat - > $1 <<EOF 289 cat - > $1 <<EOF
276# generated by ruby-fakegem.eclass $Revision: 1.36 $ 290# generated by ruby-fakegem.eclass $Revision: 1.40 $
277Gem::Specification.new do |s| 291Gem::Specification.new do |s|
278 s.name = "${RUBY_FAKEGEM_NAME}" 292 s.name = "${RUBY_FAKEGEM_NAME}"
279 s.version = "${RUBY_FAKEGEM_VERSION}" 293 s.version = "${RUBY_FAKEGEM_VERSION}"
280 s.summary = "${quoted_description}" 294 s.summary = "${quoted_description}"
281 s.homepage = "${HOMEPAGE}" 295 s.homepage = "${HOMEPAGE}"
321 335
322 cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF 336 cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF
323#!${rubycmd} 337#!${rubycmd}
324# This is a simplified version of the RubyGems wrapper 338# This is a simplified version of the RubyGems wrapper
325# 339#
326# Generated by ruby-fakegem.eclass $Revision: 1.36 $ 340# Generated by ruby-fakegem.eclass $Revision: 1.40 $
327 341
328require 'rubygems' 342require 'rubygems'
329 343
330load Gem::default_path[-1] + "/gems/${relativegembinary}" 344load Gem::default_path[-1] + "/gems/${relativegembinary}"
331 345
346 rake) 360 rake)
347 rake ${RUBY_FAKEGEM_TASK_DOC} || die "failed to (re)build documentation" 361 rake ${RUBY_FAKEGEM_TASK_DOC} || die "failed to (re)build documentation"
348 ;; 362 ;;
349 rdoc) 363 rdoc)
350 rdoc ${RUBY_FAKEGEM_DOC_SOURCES} || die "failed to (re)build documentation" 364 rdoc ${RUBY_FAKEGEM_DOC_SOURCES} || die "failed to (re)build documentation"
365 ;;
366 yard)
367 yard doc ${RUBY_FAKEGEM_DOC_SOURCES} || die "failed to (re)build documentation"
351 ;; 368 ;;
352 esac 369 esac
353 fi 370 fi
354} 371}
355 372
366 # Make sure that we're not running unpack for more than 383 # Make sure that we're not running unpack for more than
367 # one .gem file, since we won't support that at all. 384 # one .gem file, since we won't support that at all.
368 [[ -d "${S}" ]] && die "Unable to unpack ${archive}, ${S} exists" 385 [[ -d "${S}" ]] && die "Unable to unpack ${archive}, ${S} exists"
369 386
370 ebegin "Unpacking .gem file..." 387 ebegin "Unpacking .gem file..."
371 tar -mxf ${DISTDIR}/${archive} || die 388 tar -mxf "${DISTDIR}"/${archive} || die
372 eend $? 389 eend $?
373 390
374 ebegin "Uncompressing metadata" 391 ebegin "Uncompressing metadata"
375 gunzip metadata.gz || die 392 gunzip metadata.gz || die
376 eend $? 393 eend $?

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.40

  ViewVC Help
Powered by ViewVC 1.1.20