summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@gentoo.org>2012-07-08 12:38:10 +0000
committerDiego Elio Pettenò <flameeyes@gentoo.org>2012-07-08 12:38:10 +0000
commitb40846719789b1d8582304c9fec8bdc0ceb722df (patch)
treebdd041bac4658e17da204e3c73c85060d3c3d985 /eclass/ruby-ng.eclass
parentInstall a testrb-2 script for us alone, since it's no longer provided by upst... (diff)
downloadhistorical-b40846719789b1d8582304c9fec8bdc0ceb722df.tar.gz
historical-b40846719789b1d8582304c9fec8bdc0ceb722df.tar.bz2
historical-b40846719789b1d8582304c9fec8bdc0ceb722df.zip
Add a function to wrap around testrb-2 as well.
Diffstat (limited to 'eclass/ruby-ng.eclass')
-rw-r--r--eclass/ruby-ng.eclass36
1 files changed, 35 insertions, 1 deletions
diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index 149e483782a9..10034a534d54 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.47 2012/07/05 21:23:01 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.48 2012/07/08 12:38:10 flameeyes Exp $
# @ECLASS: ruby-ng.eclass
# @MAINTAINER:
@@ -658,3 +658,37 @@ ruby-ng_rspec() {
${RUBY} -S rspec ${rspec_params} "$@" || die "rspec failed"
}
+
+# @FUNCTION: ruby-ng_testrb-2
+# @DESCRIPTION:
+# This is simply a replacement for the testrb command that load the test
+# files and execute them, with test-unit 2.x. This actually requires
+# either an old test-unit-2 version or 2.5.1-r1 or later, as they remove
+# their script and we installed a broken wrapper for a while.
+# This also respects TEST_VERBOSE and NOCOLOR environment variables.
+ruby-ng_testrb-2() {
+ if [[ ${DEPEND} != *"dev-ruby/test-unit"* ]]; then
+ ewarn "Missing dev-ruby/test-unit in \${DEPEND}"
+ fi
+
+ local testrb_params=
+ case ${NOCOLOR} in
+ 1|yes|true)
+ testrb_params+=" --no-use-color"
+ ;;
+ *)
+ testrb_params+=" --use-color=auto"
+ ;;
+ esac
+
+ case ${TEST_VERBOSE} in
+ 1|yes|true)
+ testrb_params+=" --verbose=verbose"
+ ;;
+ *)
+ testrb_params+=" --verbose=normal"
+ ;;
+ esac
+
+ ${RUBY} -S testrb-2 ${testrb_params} "$@" || die "testrb-2 failed"
+}