summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@gentoo.org>2012-07-05 21:23:01 +0000
committerDiego Elio Pettenò <flameeyes@gentoo.org>2012-07-05 21:23:01 +0000
commitbc13aadd2b086c8b7bb3ac0e7e00f6640ed72f46 (patch)
treefd3198845d7db2f13e160797939e89f8272153fe /eclass/ruby-ng.eclass
parentRe-sign manifest. (diff)
downloadhistorical-bc13aadd2b086c8b7bb3ac0e7e00f6640ed72f46.tar.gz
historical-bc13aadd2b086c8b7bb3ac0e7e00f6640ed72f46.tar.bz2
historical-bc13aadd2b086c8b7bb3ac0e7e00f6640ed72f46.zip
Add support for running rspec while respecting some common variables (TEST_VERBOSE and NOCOLOR) in ruby-ng; then use this with a new variable in ruby-fakegem.
Diffstat (limited to 'eclass/ruby-ng.eclass')
-rw-r--r--eclass/ruby-ng.eclass33
1 files changed, 32 insertions, 1 deletions
diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index bd10fc39b12a..149e483782a9 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.46 2012/06/02 19:16:31 zmedico Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.47 2012/07/05 21:23:01 flameeyes Exp $
# @ECLASS: ruby-ng.eclass
# @MAINTAINER:
@@ -627,3 +627,34 @@ ruby_get_implementation() {
;;
esac
}
+
+# @FUNCTION: ruby-ng_rspec
+# @DESCRIPTION:
+# This is simply a wrapper around the rspec command (executed by $RUBY})
+# which also respects TEST_VERBOSE and NOCOLOR environment variables.
+ruby-ng_rspec() {
+ if [[ ${DEPEND} != *"dev-ruby/rspec"* ]]; then
+ ewarn "Missing dev-ruby/rspec in \${DEPEND}"
+ fi
+
+ local rspec_params=
+ case ${NOCOLOR} in
+ 1|yes|true)
+ rspec_params+=" --no-color"
+ ;;
+ *)
+ rspec_params+=" --color"
+ ;;
+ esac
+
+ case ${TEST_VERBOSE} in
+ 1|yes|true)
+ rspec_params+=" --format documentation"
+ ;;
+ *)
+ rspec_params+=" --format progress"
+ ;;
+ esac
+
+ ${RUBY} -S rspec ${rspec_params} "$@" || die "rspec failed"
+}