Merge remote-tracking branch 'github/pr/533'.
[gentoo.git] / eclass / ruby-utils.eclass
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 # @ECLASS: ruby-utils.eclass
6 # @MAINTAINER:
7 # Ruby team <ruby@gentoo.org>
8 # @AUTHOR:
9 # Author: Hans de Graaff <graaff@gentoo.org>
10 # @BLURB: An eclass for supporting ruby scripts and bindings in non-ruby packages
11 # @DESCRIPTION:
12 # The ruby-utils eclass is designed to allow an easier installation of
13 # Ruby scripts and bindings for non-ruby packages.
14 #
15 # This eclass does not set any metadata variables nor export any phase
16 # functions. It can be inherited safely.
17
18
19 if [[ ! ${_RUBY_UTILS} ]]; then
20
21
22 # @ECLASS-VARIABLE: RUBY_TARGETS_PREFERENCE
23 # @DESCRIPTION:
24 # This variable lists all the known ruby targets in preference of use as
25 # determined by the ruby team. By using this ordering rather than the
26 # USE_RUBY mandated ordering we have more control over which ruby
27 # implementation will be installed first (and thus eselected). This will
28 # provide for a better first installation experience.
29
30 # All RUBY_TARGETS
31 RUBY_TARGETS_PREFERENCE="ruby20 ruby19 "
32
33 # All other active ruby targets
34 RUBY_TARGETS_PREFERENCE+="ruby21 ruby22 ruby23"
35
36
37 _ruby_implementation_depend() {
38         local rubypn=
39         local rubyslot=
40
41         case $1 in
42                 ruby18)
43                         rubypn="dev-lang/ruby"
44                         rubyslot=":1.8"
45                         ;;
46                 ruby19)
47                         rubypn="dev-lang/ruby"
48                         rubyslot=":1.9"
49                         ;;
50                 ruby20)
51                         rubypn="dev-lang/ruby"
52                         rubyslot=":2.0"
53                         ;;
54                 ruby21)
55                         rubypn="dev-lang/ruby"
56                         rubyslot=":2.1"
57                         ;;
58                 ruby22)
59                         rubypn="dev-lang/ruby"
60                         rubyslot=":2.2"
61                         ;;
62                 ruby23)
63                         rubypn="dev-lang/ruby"
64                         rubyslot=":2.3"
65                         ;;
66                 ree18)
67                         rubypn="dev-lang/ruby-enterprise"
68                         rubyslot=":1.8"
69                         ;;
70                 jruby)
71                         rubypn="dev-java/jruby"
72                         rubyslot=""
73                         ;;
74                 rbx)
75                         rubypn="dev-lang/rubinius"
76                         rubyslot=""
77                         ;;
78                 *) die "$1: unknown Ruby implementation"
79         esac
80
81         echo "$2${rubypn}$3${rubyslot}"
82 }
83
84
85
86 _RUBY_UTILS=1
87 fi