/[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.11 Revision 1.14
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.11 2010/01/18 22:01:46 flameeyes Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.14 2010/02/13 08:45:03 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#
143 143
144 # We use the _ruby_implementation variable to avoid having stray 144 # We use the _ruby_implementation variable to avoid having stray
145 # copies with different implementations; while for now we're using 145 # copies with different implementations; while for now we're using
146 # the same exact content, we might have differences in the future, 146 # the same exact content, we might have differences in the future,
147 # so better taking this into consideration. 147 # so better taking this into consideration.
148 local quoted_description=${DESCRIPTION//\"/\\\"}
148 cat - > "${T}"/${RUBY_FAKEGEM_NAME}-${_ruby_implementation} <<EOF 149 cat - > "${T}"/${RUBY_FAKEGEM_NAME}-${_ruby_implementation} <<EOF
149Gem::Specification.new do |s| 150Gem::Specification.new do |s|
150 s.name = "${RUBY_FAKEGEM_NAME}" 151 s.name = "${RUBY_FAKEGEM_NAME}"
151 s.version = "${RUBY_FAKEGEM_VERSION}" 152 s.version = "${RUBY_FAKEGEM_VERSION}"
152 s.summary = "${DESCRIPTION}" 153 s.summary = "${quoted_description}"
153 s.homepage = "${HOMEPAGE}" 154 s.homepage = "${HOMEPAGE}"
154 s.require_paths = [${required_paths}] 155 s.require_paths = [${required_paths}]
155end 156end
156EOF 157EOF
157 158
168ruby_fakegem_binwrapper() { 169ruby_fakegem_binwrapper() {
169 ( 170 (
170 local gembinary=$1 171 local gembinary=$1
171 local newbinary=${2:-/usr/bin/$gembinary} 172 local newbinary=${2:-/usr/bin/$gembinary}
172 local relativegembinary=${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin/${gembinary} 173 local relativegembinary=${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin/${gembinary}
174 local binpath=$(dirname $newbinary)
175 [[ ${binpath} = . ]] && binpath=/usr/bin
173 176
174 cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF 177 cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF
175#!/usr/bin/env ruby 178#!/usr/bin/env ruby
176# This is a simplified version of the RubyGems wrapper 179# This is a simplified version of the RubyGems wrapper
177# 180#
181 184
182load Gem::default_path[-1] + "/gems/${relativegembinary}" 185load Gem::default_path[-1] + "/gems/${relativegembinary}"
183 186
184EOF 187EOF
185 188
186 exeinto $(dirname $newbinary) 189 exeinto ${binpath:-/usr/bin}
187 newexe "${T}"/gembin-wrapper-${gembinary} $(basename $newbinary) 190 newexe "${T}"/gembin-wrapper-${gembinary} $(basename $newbinary)
188 ) || die "Unable to create fakegem wrapper" 191 ) || die "Unable to create fakegem wrapper"
189} 192}
190 193
191# @FUNCTION: all_fakegem_compile 194# @FUNCTION: all_fakegem_compile
236# @FUNCTION: each_fakegem_test 239# @FUNCTION: each_fakegem_test
237# @DESCRIPTION: 240# @DESCRIPTION:
238# Run tests for the package for each ruby target if the test task is defined. 241# Run tests for the package for each ruby target if the test task is defined.
239each_fakegem_test() { 242each_fakegem_test() {
240 local rubyflags= 243 local rubyflags=
241
242 if [[ ${RUBY_FAKEGEM_TASK_TEST} != "" ]]; then
243 ${RUBY} ${rubyflags} -S rake ${RUBY_FAKEGEM_TASK_TEST} || die "tests failed" 244 ${RUBY} ${rubyflags} -S rake ${RUBY_FAKEGEM_TASK_TEST} || die "tests failed"
244 else
245 echo "No test task defined, skipping tests."
246 fi
247} 245}
248 246
247if [[ ${RUBY_FAKEGEM_TASK_TEST} != "" ]]; then
249# @FUNCTION: each_ruby_test 248 # @FUNCTION: each_ruby_test
250# @DESCRIPTION: 249 # @DESCRIPTION:
251# Run the tests for this package. 250 # Run the tests for this package.
252each_ruby_test() { 251 each_ruby_test() {
253 each_fakegem_test 252 each_fakegem_test
254} 253 }
254fi
255 255
256# @FUNCTION: each_fakegem_install 256# @FUNCTION: each_fakegem_install
257# @DESCRIPTION: 257# @DESCRIPTION:
258# Install the package for each ruby target. 258# Install the package for each ruby target.
259each_fakegem_install() { 259each_fakegem_install() {

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.20