/[gentoo-x86]/eclass/ruby-ng.eclass
Gentoo

Diff of /eclass/ruby-ng.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.46 Revision 1.52
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2013 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.46 2012/06/02 19:16:31 zmedico Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.52 2013/06/23 14:56:07 graaff 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:
15# and their incorporation into the Gentoo Linux system. 15# and their incorporation into the Gentoo Linux system.
16# 16#
17# Currently available targets are: 17# Currently available targets are:
18# * ruby18 - Ruby (MRI) 1.8.x 18# * ruby18 - Ruby (MRI) 1.8.x
19# * ruby19 - Ruby (MRI) 1.9.x 19# * ruby19 - Ruby (MRI) 1.9.x
20# * ruby20 - Ruby (MRI) 2.0.x
20# * ree18 - Ruby Enterprise Edition 1.8.x 21# * ree18 - Ruby Enterprise Edition 1.8.x
21# * jruby - JRuby 22# * jruby - JRuby
22# * rbx - Rubinius 23# * rbx - Rubinius
23# 24#
24# This eclass does not define the implementation of the configure, 25# This eclass does not define the implementation of the configure,
75 76
76case ${EAPI} in 77case ${EAPI} in
77 0|1) 78 0|1)
78 die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;; 79 die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;;
79 2|3) ;; 80 2|3) ;;
80 4) 81 4|5)
81 # S is no longer automatically assigned when it doesn't exist. 82 # S is no longer automatically assigned when it doesn't exist.
82 S="${WORKDIR}" 83 S="${WORKDIR}"
83 ;; 84 ;;
84 *) 85 *)
85 die "Unknown EAPI=${EAPI} for ruby-ng.eclass" 86 die "Unknown EAPI=${EAPI} for ruby-ng.eclass"
105 rubyslot=":1.8" 106 rubyslot=":1.8"
106 ;; 107 ;;
107 ruby19) 108 ruby19)
108 rubypn="dev-lang/ruby" 109 rubypn="dev-lang/ruby"
109 rubyslot=":1.9" 110 rubyslot=":1.9"
111 ;;
112 ruby20)
113 rubypn="dev-lang/ruby"
114 rubyslot=":2.0"
110 ;; 115 ;;
111 ree18) 116 ree18)
112 rubypn="dev-lang/ruby-enterprise" 117 rubypn="dev-lang/ruby-enterprise"
113 rubyslot=":1.8" 118 rubyslot=":1.8"
114 ;; 119 ;;
312# ruby useflag and dependency. 317# ruby useflag and dependency.
313if [[ ${RUBY_OPTIONAL} != yes ]]; then 318if [[ ${RUBY_OPTIONAL} != yes ]]; then
314 DEPEND="${DEPEND} $(ruby_implementations_depend)" 319 DEPEND="${DEPEND} $(ruby_implementations_depend)"
315 RDEPEND="${RDEPEND} $(ruby_implementations_depend)" 320 RDEPEND="${RDEPEND} $(ruby_implementations_depend)"
316 321
322 case ${EAPI:-0} in
323 4|5)
317 [[ ${EAPI:-0} -ge 4 ]] && REQUIRED_USE+=" || ( $(ruby_get_use_targets) )" 324 REQUIRED_USE+=" || ( $(ruby_get_use_targets) )"
325 ;;
326 esac
318fi 327fi
319 328
320_ruby_invoke_environment() { 329_ruby_invoke_environment() {
321 old_S=${S} 330 old_S=${S}
322 case ${EAPI} in 331 case ${EAPI} in
323 4) 332 4|5)
324 if [ -z ${RUBY_S} ]; then 333 if [ -z ${RUBY_S} ]; then
325 sub_S=${P} 334 sub_S=${P}
326 else 335 else
327 sub_S=${RUBY_S} 336 sub_S=${RUBY_S}
328 fi 337 fi
625 *) 634 *)
626 echo "mri" 635 echo "mri"
627 ;; 636 ;;
628 esac 637 esac
629} 638}
639
640# @FUNCTION: ruby-ng_rspec
641# @DESCRIPTION:
642# This is simply a wrapper around the rspec command (executed by $RUBY})
643# which also respects TEST_VERBOSE and NOCOLOR environment variables.
644ruby-ng_rspec() {
645 if [[ ${DEPEND} != *"dev-ruby/rspec"* ]]; then
646 ewarn "Missing dev-ruby/rspec in \${DEPEND}"
647 fi
648
649 local rspec_params=
650 case ${NOCOLOR} in
651 1|yes|true)
652 rspec_params+=" --no-color"
653 ;;
654 *)
655 rspec_params+=" --color"
656 ;;
657 esac
658
659 case ${TEST_VERBOSE} in
660 1|yes|true)
661 rspec_params+=" --format documentation"
662 ;;
663 *)
664 rspec_params+=" --format progress"
665 ;;
666 esac
667
668 ${RUBY} -S rspec ${rspec_params} "$@" || die "rspec failed"
669}
670
671# @FUNCTION: ruby-ng_cucumber
672# @DESCRIPTION:
673# This is simply a wrapper around the cucumber command (executed by $RUBY})
674# which also respects TEST_VERBOSE and NOCOLOR environment variables.
675ruby-ng_cucumber() {
676 if [[ ${DEPEND} != *"dev-util/cucumber"* ]]; then
677 ewarn "Missing dev-util/cucumber in \${DEPEND}"
678 fi
679
680 local cucumber_params=
681 case ${NOCOLOR} in
682 1|yes|true)
683 cucumber_params+=" --no-color"
684 ;;
685 *)
686 cucumber_params+=" --color"
687 ;;
688 esac
689
690 case ${TEST_VERBOSE} in
691 1|yes|true)
692 cucumber_params+=" --format pretty"
693 ;;
694 *)
695 cucumber_params+=" --format progress"
696 ;;
697 esac
698
699 if [[ ${RUBY} == *jruby ]]; then
700 ewarn "Skipping cucumber tests on JRuby (unsupported)."
701 return 0
702 fi
703
704 ${RUBY} -S cucumber ${cucumber_params} "$@" || die "cucumber failed"
705}
706
707# @FUNCTION: ruby-ng_testrb-2
708# @DESCRIPTION:
709# This is simply a replacement for the testrb command that load the test
710# files and execute them, with test-unit 2.x. This actually requires
711# either an old test-unit-2 version or 2.5.1-r1 or later, as they remove
712# their script and we installed a broken wrapper for a while.
713# This also respects TEST_VERBOSE and NOCOLOR environment variables.
714ruby-ng_testrb-2() {
715 if [[ ${DEPEND} != *"dev-ruby/test-unit"* ]]; then
716 ewarn "Missing dev-ruby/test-unit in \${DEPEND}"
717 fi
718
719 local testrb_params=
720 case ${NOCOLOR} in
721 1|yes|true)
722 testrb_params+=" --no-use-color"
723 ;;
724 *)
725 testrb_params+=" --use-color=auto"
726 ;;
727 esac
728
729 case ${TEST_VERBOSE} in
730 1|yes|true)
731 testrb_params+=" --verbose=verbose"
732 ;;
733 *)
734 testrb_params+=" --verbose=normal"
735 ;;
736 esac
737
738 ${RUBY} -S testrb-2 ${testrb_params} "$@" || die "testrb-2 failed"
739}

Legend:
Removed from v.1.46  
changed lines
  Added in v.1.52

  ViewVC Help
Powered by ViewVC 1.1.20