/[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.47 Revision 1.54
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2014 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.54 2014/01/16 07:57:40 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
21# * ruby21 - Ruby (MRI) 2.1.x
20# * ree18 - Ruby Enterprise Edition 1.8.x 22# * ree18 - Ruby Enterprise Edition 1.8.x
21# * jruby - JRuby 23# * jruby - JRuby
22# * rbx - Rubinius 24# * rbx - Rubinius
23# 25#
24# This eclass does not define the implementation of the configure, 26# This eclass does not define the implementation of the configure,
75 77
76case ${EAPI} in 78case ${EAPI} in
77 0|1) 79 0|1)
78 die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;; 80 die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;;
79 2|3) ;; 81 2|3) ;;
80 4) 82 4|5)
81 # S is no longer automatically assigned when it doesn't exist. 83 # S is no longer automatically assigned when it doesn't exist.
82 S="${WORKDIR}" 84 S="${WORKDIR}"
83 ;; 85 ;;
84 *) 86 *)
85 die "Unknown EAPI=${EAPI} for ruby-ng.eclass" 87 die "Unknown EAPI=${EAPI} for ruby-ng.eclass"
105 rubyslot=":1.8" 107 rubyslot=":1.8"
106 ;; 108 ;;
107 ruby19) 109 ruby19)
108 rubypn="dev-lang/ruby" 110 rubypn="dev-lang/ruby"
109 rubyslot=":1.9" 111 rubyslot=":1.9"
112 ;;
113 ruby20)
114 rubypn="dev-lang/ruby"
115 rubyslot=":2.0"
116 ;;
117 ruby21)
118 rubypn="dev-lang/ruby"
119 rubyslot=":2.1"
110 ;; 120 ;;
111 ree18) 121 ree18)
112 rubypn="dev-lang/ruby-enterprise" 122 rubypn="dev-lang/ruby-enterprise"
113 rubyslot=":1.8" 123 rubyslot=":1.8"
114 ;; 124 ;;
312# ruby useflag and dependency. 322# ruby useflag and dependency.
313if [[ ${RUBY_OPTIONAL} != yes ]]; then 323if [[ ${RUBY_OPTIONAL} != yes ]]; then
314 DEPEND="${DEPEND} $(ruby_implementations_depend)" 324 DEPEND="${DEPEND} $(ruby_implementations_depend)"
315 RDEPEND="${RDEPEND} $(ruby_implementations_depend)" 325 RDEPEND="${RDEPEND} $(ruby_implementations_depend)"
316 326
327 case ${EAPI:-0} in
328 4|5)
317 [[ ${EAPI:-0} -ge 4 ]] && REQUIRED_USE+=" || ( $(ruby_get_use_targets) )" 329 REQUIRED_USE+=" || ( $(ruby_get_use_targets) )"
330 ;;
331 esac
318fi 332fi
319 333
320_ruby_invoke_environment() { 334_ruby_invoke_environment() {
321 old_S=${S} 335 old_S=${S}
322 case ${EAPI} in 336 case ${EAPI} in
323 4) 337 4|5)
324 if [ -z ${RUBY_S} ]; then 338 if [ -z ${RUBY_S} ]; then
325 sub_S=${P} 339 sub_S=${P}
326 else 340 else
327 sub_S=${RUBY_S} 341 sub_S=${RUBY_S}
328 fi 342 fi
441} 455}
442 456
443_ruby_source_copy() { 457_ruby_source_copy() {
444 # Until we actually find a reason not to, we use hardlinks, this 458 # Until we actually find a reason not to, we use hardlinks, this
445 # should reduce the amount of disk space that is wasted by this. 459 # should reduce the amount of disk space that is wasted by this.
446 cp -prl all ${_ruby_implementation} \ 460 cp -prlP all ${_ruby_implementation} \
447 || die "Unable to copy ${_ruby_implementation} environment" 461 || die "Unable to copy ${_ruby_implementation} environment"
448} 462}
449 463
450# @FUNCTION: ruby-ng_src_prepare 464# @FUNCTION: ruby-ng_src_prepare
451# @DESCRIPTION: 465# @DESCRIPTION:
656 ;; 670 ;;
657 esac 671 esac
658 672
659 ${RUBY} -S rspec ${rspec_params} "$@" || die "rspec failed" 673 ${RUBY} -S rspec ${rspec_params} "$@" || die "rspec failed"
660} 674}
675
676# @FUNCTION: ruby-ng_cucumber
677# @DESCRIPTION:
678# This is simply a wrapper around the cucumber command (executed by $RUBY})
679# which also respects TEST_VERBOSE and NOCOLOR environment variables.
680ruby-ng_cucumber() {
681 if [[ ${DEPEND} != *"dev-util/cucumber"* ]]; then
682 ewarn "Missing dev-util/cucumber in \${DEPEND}"
683 fi
684
685 local cucumber_params=
686 case ${NOCOLOR} in
687 1|yes|true)
688 cucumber_params+=" --no-color"
689 ;;
690 *)
691 cucumber_params+=" --color"
692 ;;
693 esac
694
695 case ${TEST_VERBOSE} in
696 1|yes|true)
697 cucumber_params+=" --format pretty"
698 ;;
699 *)
700 cucumber_params+=" --format progress"
701 ;;
702 esac
703
704 if [[ ${RUBY} == *jruby ]]; then
705 ewarn "Skipping cucumber tests on JRuby (unsupported)."
706 return 0
707 fi
708
709 ${RUBY} -S cucumber ${cucumber_params} "$@" || die "cucumber failed"
710}
711
712# @FUNCTION: ruby-ng_testrb-2
713# @DESCRIPTION:
714# This is simply a replacement for the testrb command that load the test
715# files and execute them, with test-unit 2.x. This actually requires
716# either an old test-unit-2 version or 2.5.1-r1 or later, as they remove
717# their script and we installed a broken wrapper for a while.
718# This also respects TEST_VERBOSE and NOCOLOR environment variables.
719ruby-ng_testrb-2() {
720 if [[ ${DEPEND} != *"dev-ruby/test-unit"* ]]; then
721 ewarn "Missing dev-ruby/test-unit in \${DEPEND}"
722 fi
723
724 local testrb_params=
725 case ${NOCOLOR} in
726 1|yes|true)
727 testrb_params+=" --no-use-color"
728 ;;
729 *)
730 testrb_params+=" --use-color=auto"
731 ;;
732 esac
733
734 case ${TEST_VERBOSE} in
735 1|yes|true)
736 testrb_params+=" --verbose=verbose"
737 ;;
738 *)
739 testrb_params+=" --verbose=normal"
740 ;;
741 esac
742
743 ${RUBY} -S testrb-2 ${testrb_params} "$@" || die "testrb-2 failed"
744}

Legend:
Removed from v.1.47  
changed lines
  Added in v.1.54

  ViewVC Help
Powered by ViewVC 1.1.20