| 1 | # Copyright 1999-2012 Gentoo Foundation |
1 | # Copyright 1999-2012 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-ng.eclass,v 1.47 2012/07/05 21:23:01 flameeyes Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.51 2012/09/27 16:35:41 axs Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: ruby-ng.eclass |
5 | # @ECLASS: ruby-ng.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Ruby herd <ruby@gentoo.org> |
7 | # Ruby herd <ruby@gentoo.org> |
| 8 | # @AUTHOR: |
8 | # @AUTHOR: |
| … | |
… | |
| 75 | |
75 | |
| 76 | case ${EAPI} in |
76 | case ${EAPI} in |
| 77 | 0|1) |
77 | 0|1) |
| 78 | die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;; |
78 | die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;; |
| 79 | 2|3) ;; |
79 | 2|3) ;; |
| 80 | 4) |
80 | 4|5) |
| 81 | # S is no longer automatically assigned when it doesn't exist. |
81 | # S is no longer automatically assigned when it doesn't exist. |
| 82 | S="${WORKDIR}" |
82 | S="${WORKDIR}" |
| 83 | ;; |
83 | ;; |
| 84 | *) |
84 | *) |
| 85 | die "Unknown EAPI=${EAPI} for ruby-ng.eclass" |
85 | die "Unknown EAPI=${EAPI} for ruby-ng.eclass" |
| … | |
… | |
| 312 | # ruby useflag and dependency. |
312 | # ruby useflag and dependency. |
| 313 | if [[ ${RUBY_OPTIONAL} != yes ]]; then |
313 | if [[ ${RUBY_OPTIONAL} != yes ]]; then |
| 314 | DEPEND="${DEPEND} $(ruby_implementations_depend)" |
314 | DEPEND="${DEPEND} $(ruby_implementations_depend)" |
| 315 | RDEPEND="${RDEPEND} $(ruby_implementations_depend)" |
315 | RDEPEND="${RDEPEND} $(ruby_implementations_depend)" |
| 316 | |
316 | |
|
|
317 | case ${EAPI:-0} in |
|
|
318 | 4|5) |
| 317 | [[ ${EAPI:-0} -ge 4 ]] && REQUIRED_USE+=" || ( $(ruby_get_use_targets) )" |
319 | REQUIRED_USE+=" || ( $(ruby_get_use_targets) )" |
|
|
320 | ;; |
|
|
321 | esac |
| 318 | fi |
322 | fi |
| 319 | |
323 | |
| 320 | _ruby_invoke_environment() { |
324 | _ruby_invoke_environment() { |
| 321 | old_S=${S} |
325 | old_S=${S} |
| 322 | case ${EAPI} in |
326 | case ${EAPI} in |
| 323 | 4) |
327 | 4|5) |
| 324 | if [ -z ${RUBY_S} ]; then |
328 | if [ -z ${RUBY_S} ]; then |
| 325 | sub_S=${P} |
329 | sub_S=${P} |
| 326 | else |
330 | else |
| 327 | sub_S=${RUBY_S} |
331 | sub_S=${RUBY_S} |
| 328 | fi |
332 | fi |
| … | |
… | |
| 656 | ;; |
660 | ;; |
| 657 | esac |
661 | esac |
| 658 | |
662 | |
| 659 | ${RUBY} -S rspec ${rspec_params} "$@" || die "rspec failed" |
663 | ${RUBY} -S rspec ${rspec_params} "$@" || die "rspec failed" |
| 660 | } |
664 | } |
|
|
665 | |
|
|
666 | # @FUNCTION: ruby-ng_cucumber |
|
|
667 | # @DESCRIPTION: |
|
|
668 | # This is simply a wrapper around the cucumber command (executed by $RUBY}) |
|
|
669 | # which also respects TEST_VERBOSE and NOCOLOR environment variables. |
|
|
670 | ruby-ng_cucumber() { |
|
|
671 | if [[ ${DEPEND} != *"dev-util/cucumber"* ]]; then |
|
|
672 | ewarn "Missing dev-util/cucumber in \${DEPEND}" |
|
|
673 | fi |
|
|
674 | |
|
|
675 | local cucumber_params= |
|
|
676 | case ${NOCOLOR} in |
|
|
677 | 1|yes|true) |
|
|
678 | cucumber_params+=" --no-color" |
|
|
679 | ;; |
|
|
680 | *) |
|
|
681 | cucumber_params+=" --color" |
|
|
682 | ;; |
|
|
683 | esac |
|
|
684 | |
|
|
685 | case ${TEST_VERBOSE} in |
|
|
686 | 1|yes|true) |
|
|
687 | cucumber_params+=" --format pretty" |
|
|
688 | ;; |
|
|
689 | *) |
|
|
690 | cucumber_params+=" --format progress" |
|
|
691 | ;; |
|
|
692 | esac |
|
|
693 | |
|
|
694 | if [[ ${RUBY} == *jruby ]]; then |
|
|
695 | ewarn "Skipping cucumber tests on JRuby (unsupported)." |
|
|
696 | return 0 |
|
|
697 | fi |
|
|
698 | |
|
|
699 | ${RUBY} -S cucumber ${cucumber_params} "$@" || die "cucumber failed" |
|
|
700 | } |
|
|
701 | |
|
|
702 | # @FUNCTION: ruby-ng_testrb-2 |
|
|
703 | # @DESCRIPTION: |
|
|
704 | # This is simply a replacement for the testrb command that load the test |
|
|
705 | # files and execute them, with test-unit 2.x. This actually requires |
|
|
706 | # either an old test-unit-2 version or 2.5.1-r1 or later, as they remove |
|
|
707 | # their script and we installed a broken wrapper for a while. |
|
|
708 | # This also respects TEST_VERBOSE and NOCOLOR environment variables. |
|
|
709 | ruby-ng_testrb-2() { |
|
|
710 | if [[ ${DEPEND} != *"dev-ruby/test-unit"* ]]; then |
|
|
711 | ewarn "Missing dev-ruby/test-unit in \${DEPEND}" |
|
|
712 | fi |
|
|
713 | |
|
|
714 | local testrb_params= |
|
|
715 | case ${NOCOLOR} in |
|
|
716 | 1|yes|true) |
|
|
717 | testrb_params+=" --no-use-color" |
|
|
718 | ;; |
|
|
719 | *) |
|
|
720 | testrb_params+=" --use-color=auto" |
|
|
721 | ;; |
|
|
722 | esac |
|
|
723 | |
|
|
724 | case ${TEST_VERBOSE} in |
|
|
725 | 1|yes|true) |
|
|
726 | testrb_params+=" --verbose=verbose" |
|
|
727 | ;; |
|
|
728 | *) |
|
|
729 | testrb_params+=" --verbose=normal" |
|
|
730 | ;; |
|
|
731 | esac |
|
|
732 | |
|
|
733 | ${RUBY} -S testrb-2 ${testrb_params} "$@" || die "testrb-2 failed" |
|
|
734 | } |