From c47ae3bafd3b911e9ab5110b945e939388d38b52 Mon Sep 17 00:00:00 2001 From: Hans de Graaff Date: Sun, 28 Dec 2014 07:23:56 +0000 Subject: [PATCH] Use rspec-2 wrapper for the rspec recipe. --- eclass/ChangeLog | 8 +++++++- eclass/ruby-fakegem.eclass | 12 +++++++----- eclass/ruby-ng.eclass | 19 ++++++++++++++++--- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/eclass/ChangeLog b/eclass/ChangeLog index 4e75d981ae20..79589f7ef077 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for eclass directory # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1481 2014/12/27 23:52:24 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1482 2014/12/28 07:23:56 graaff Exp $ + + 28 Dec 2014; Hans de Graaff ruby-fakegem.eclass, + ruby-ng.eclass: + Use rspec-2 wrapper for the rspec recipe. This enables us to add rspec 3.x to + the tree while still being able to run rspec 2 specs. The changes have been + made in a way that is backwards compatible with the current situation. 27 Dec 2014; Michał Górny python-utils-r1.eclass: Update banned var docs. diff --git a/eclass/ruby-fakegem.eclass b/eclass/ruby-fakegem.eclass index 3ed591e681fd..50da8876e314 100644 --- a/eclass/ruby-fakegem.eclass +++ b/eclass/ruby-fakegem.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.42 2014/12/07 07:23:12 graaff Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.43 2014/12/28 07:23:56 graaff Exp $ # @ECLASS: ruby-fakegem.eclass # @MAINTAINER: @@ -141,7 +141,9 @@ case ${RUBY_FAKEGEM_RECIPE_TEST} in ;; rspec) IUSE+=" test" - ruby_add_bdepend "test? ( dev-ruby/rspec:2 )" + # Also require a new enough rspec-core version that installs the + # rspec-2 wrapper. + ruby_add_bdepend "test? ( dev-ruby/rspec:2 >=dev-ruby/rspec-core-2.14.8-r2 )" ;; cucumber) IUSE+=" test" @@ -287,7 +289,7 @@ ruby_fakegem_genspec() { # so better taking this into consideration. local quoted_description=${DESCRIPTION//\"/\\\"} cat - > $1 < # @DESCRIPTION: # This is simply a wrapper around the rspec command (executed by $RUBY}) # which also respects TEST_VERBOSE and NOCOLOR environment variables. +# Optionally takes arguments to pass on to the rspec invocation. The +# environment variable RSPEC_VERSION can be used to control the specific +# rspec version that must be executed. It defaults to 2 for historical +# compatibility. ruby-ng_rspec() { + local version=${RSPEC_VERSION-2} + local files="$@" + + # Explicitly pass the expected spec directory since the versioned + # rspec wrappers don't handle this automatically. + if [ ${#@} -eq 0 ]; then + files="spec" + fi + if [[ ${DEPEND} != *"dev-ruby/rspec"* ]]; then ewarn "Missing dev-ruby/rspec in \${DEPEND}" fi @@ -675,7 +688,7 @@ ruby-ng_rspec() { ;; esac - ${RUBY} -S rspec ${rspec_params} "$@" || die "rspec failed" + ${RUBY} -S rspec-${version} ${rspec_params} ${files} || die "rspec failed" } # @FUNCTION: ruby-ng_cucumber -- 2.26.2