commit:     3bb3c9e4d9439e3f814ab53337bd24d7822681fe
Author:     Hans de Graaff <hans <AT> degraaff <DOT> org>
AuthorDate: Mon May 11 18:24:42 2015 +0000
Commit:     Hans de Graaff <graaff <AT> gentoo <DOT> org>
CommitDate: Mon May 11 18:24:42 2015 +0000
URL:        https://gitweb.gentoo.org/proj/ruby-overlay.git/commit/?id=3bb3c9e4

Sync with ruby-ng.eclass in the gentoo repository.

 eclass/ruby-ng.eclass    | 18 ++++++++++++++++--
 eclass/ruby-utils.eclass |  3 +++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index 5af4683..a06fcd4 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -19,6 +19,7 @@
 #  * ruby19 - Ruby (MRI) 1.9.x
 #  * ruby20 - Ruby (MRI) 2.0.x
 #  * ruby21 - Ruby (MRI) 2.1.x
+#  * ruby22 - Ruby (MRI) 2.2.x
 #  * ree18  - Ruby Enterprise Edition 1.8.x
 #  * jruby  - JRuby
 #  * rbx    - Rubinius
@@ -608,11 +609,24 @@ ruby_get_implementation() {
        esac
 }
 
-# @FUNCTION: ruby-ng_rspec
+# @FUNCTION: ruby-ng_rspec <arguments>
 # @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
@@ -636,7 +650,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

diff --git a/eclass/ruby-utils.eclass b/eclass/ruby-utils.eclass
index 2693045..9aef502 100644
--- a/eclass/ruby-utils.eclass
+++ b/eclass/ruby-utils.eclass
@@ -63,6 +63,9 @@ _ruby_implementation_depend() {
                        rubypn="dev-lang/ruby"
                        rubyslot=":2.1"
                        ;;
+               ruby22)
+                       rubypn="dev-lang/ruby"
+                       rubyslot=":2.2"
                ree18)
                        rubypn="dev-lang/ruby-enterprise"
                        rubyslot=":1.8"

Reply via email to