/[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.56
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.46 2012/06/02 19:16:31 zmedico Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.56 2014/12/28 07:23:56 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
22# * ruby22 - Ruby (MRI) 2.2.x
20# * ree18 - Ruby Enterprise Edition 1.8.x 23# * ree18 - Ruby Enterprise Edition 1.8.x
21# * jruby - JRuby 24# * jruby - JRuby
22# * rbx - Rubinius 25# * rbx - Rubinius
23# 26#
24# This eclass does not define the implementation of the configure, 27# This eclass does not define the implementation of the configure,
75 78
76case ${EAPI} in 79case ${EAPI} in
77 0|1) 80 0|1)
78 die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;; 81 die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;;
79 2|3) ;; 82 2|3) ;;
80 4) 83 4|5)
81 # S is no longer automatically assigned when it doesn't exist. 84 # S is no longer automatically assigned when it doesn't exist.
82 S="${WORKDIR}" 85 S="${WORKDIR}"
83 ;; 86 ;;
84 *) 87 *)
85 die "Unknown EAPI=${EAPI} for ruby-ng.eclass" 88 die "Unknown EAPI=${EAPI} for ruby-ng.eclass"
105 rubyslot=":1.8" 108 rubyslot=":1.8"
106 ;; 109 ;;
107 ruby19) 110 ruby19)
108 rubypn="dev-lang/ruby" 111 rubypn="dev-lang/ruby"
109 rubyslot=":1.9" 112 rubyslot=":1.9"
113 ;;
114 ruby20)
115 rubypn="dev-lang/ruby"
116 rubyslot=":2.0"
117 ;;
118 ruby21)
119 rubypn="dev-lang/ruby"
120 rubyslot=":2.1"
121 ;;
122 ruby22)
123 rubypn="dev-lang/ruby"
124 rubyslot=":2.2"
110 ;; 125 ;;
111 ree18) 126 ree18)
112 rubypn="dev-lang/ruby-enterprise" 127 rubypn="dev-lang/ruby-enterprise"
113 rubyslot=":1.8" 128 rubyslot=":1.8"
114 ;; 129 ;;
312# ruby useflag and dependency. 327# ruby useflag and dependency.
313if [[ ${RUBY_OPTIONAL} != yes ]]; then 328if [[ ${RUBY_OPTIONAL} != yes ]]; then
314 DEPEND="${DEPEND} $(ruby_implementations_depend)" 329 DEPEND="${DEPEND} $(ruby_implementations_depend)"
315 RDEPEND="${RDEPEND} $(ruby_implementations_depend)" 330 RDEPEND="${RDEPEND} $(ruby_implementations_depend)"
316 331
332 case ${EAPI:-0} in
333 4|5)
317 [[ ${EAPI:-0} -ge 4 ]] && REQUIRED_USE+=" || ( $(ruby_get_use_targets) )" 334 REQUIRED_USE+=" || ( $(ruby_get_use_targets) )"
335 ;;
336 esac
318fi 337fi
319 338
320_ruby_invoke_environment() { 339_ruby_invoke_environment() {
321 old_S=${S} 340 old_S=${S}
322 case ${EAPI} in 341 case ${EAPI} in
323 4) 342 4|5)
324 if [ -z ${RUBY_S} ]; then 343 if [ -z ${RUBY_S} ]; then
325 sub_S=${P} 344 sub_S=${P}
326 else 345 else
327 sub_S=${RUBY_S} 346 sub_S=${RUBY_S}
328 fi 347 fi
441} 460}
442 461
443_ruby_source_copy() { 462_ruby_source_copy() {
444 # Until we actually find a reason not to, we use hardlinks, this 463 # 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. 464 # should reduce the amount of disk space that is wasted by this.
446 cp -prl all ${_ruby_implementation} \ 465 cp -prlP all ${_ruby_implementation} \
447 || die "Unable to copy ${_ruby_implementation} environment" 466 || die "Unable to copy ${_ruby_implementation} environment"
448} 467}
449 468
450# @FUNCTION: ruby-ng_src_prepare 469# @FUNCTION: ruby-ng_src_prepare
451# @DESCRIPTION: 470# @DESCRIPTION:
625 *) 644 *)
626 echo "mri" 645 echo "mri"
627 ;; 646 ;;
628 esac 647 esac
629} 648}
649
650# @FUNCTION: ruby-ng_rspec <arguments>
651# @DESCRIPTION:
652# This is simply a wrapper around the rspec command (executed by $RUBY})
653# which also respects TEST_VERBOSE and NOCOLOR environment variables.
654# Optionally takes arguments to pass on to the rspec invocation. The
655# environment variable RSPEC_VERSION can be used to control the specific
656# rspec version that must be executed. It defaults to 2 for historical
657# compatibility.
658ruby-ng_rspec() {
659 local version=${RSPEC_VERSION-2}
660 local files="$@"
661
662 # Explicitly pass the expected spec directory since the versioned
663 # rspec wrappers don't handle this automatically.
664 if [ ${#@} -eq 0 ]; then
665 files="spec"
666 fi
667
668 if [[ ${DEPEND} != *"dev-ruby/rspec"* ]]; then
669 ewarn "Missing dev-ruby/rspec in \${DEPEND}"
670 fi
671
672 local rspec_params=
673 case ${NOCOLOR} in
674 1|yes|true)
675 rspec_params+=" --no-color"
676 ;;
677 *)
678 rspec_params+=" --color"
679 ;;
680 esac
681
682 case ${TEST_VERBOSE} in
683 1|yes|true)
684 rspec_params+=" --format documentation"
685 ;;
686 *)
687 rspec_params+=" --format progress"
688 ;;
689 esac
690
691 ${RUBY} -S rspec-${version} ${rspec_params} ${files} || die "rspec failed"
692}
693
694# @FUNCTION: ruby-ng_cucumber
695# @DESCRIPTION:
696# This is simply a wrapper around the cucumber command (executed by $RUBY})
697# which also respects TEST_VERBOSE and NOCOLOR environment variables.
698ruby-ng_cucumber() {
699 if [[ ${DEPEND} != *"dev-util/cucumber"* ]]; then
700 ewarn "Missing dev-util/cucumber in \${DEPEND}"
701 fi
702
703 local cucumber_params=
704 case ${NOCOLOR} in
705 1|yes|true)
706 cucumber_params+=" --no-color"
707 ;;
708 *)
709 cucumber_params+=" --color"
710 ;;
711 esac
712
713 case ${TEST_VERBOSE} in
714 1|yes|true)
715 cucumber_params+=" --format pretty"
716 ;;
717 *)
718 cucumber_params+=" --format progress"
719 ;;
720 esac
721
722 if [[ ${RUBY} == *jruby ]]; then
723 ewarn "Skipping cucumber tests on JRuby (unsupported)."
724 return 0
725 fi
726
727 ${RUBY} -S cucumber ${cucumber_params} "$@" || die "cucumber failed"
728}
729
730# @FUNCTION: ruby-ng_testrb-2
731# @DESCRIPTION:
732# This is simply a replacement for the testrb command that load the test
733# files and execute them, with test-unit 2.x. This actually requires
734# either an old test-unit-2 version or 2.5.1-r1 or later, as they remove
735# their script and we installed a broken wrapper for a while.
736# This also respects TEST_VERBOSE and NOCOLOR environment variables.
737ruby-ng_testrb-2() {
738 if [[ ${DEPEND} != *"dev-ruby/test-unit"* ]]; then
739 ewarn "Missing dev-ruby/test-unit in \${DEPEND}"
740 fi
741
742 local testrb_params=
743 case ${NOCOLOR} in
744 1|yes|true)
745 testrb_params+=" --no-use-color"
746 ;;
747 *)
748 testrb_params+=" --use-color=auto"
749 ;;
750 esac
751
752 case ${TEST_VERBOSE} in
753 1|yes|true)
754 testrb_params+=" --verbose=verbose"
755 ;;
756 *)
757 testrb_params+=" --verbose=normal"
758 ;;
759 esac
760
761 ${RUBY} -S testrb-2 ${testrb_params} "$@" || die "testrb-2 failed"
762}

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

  ViewVC Help
Powered by ViewVC 1.1.20