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

Contents of /eclass/ruby-ng.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.36 - (hide annotations) (download)
Fri Jul 22 09:08:59 2011 UTC (3 years, 4 months ago) by graaff
Branch: MAIN
Changes since 1.35: +16 -1 lines
Leverage the REQUIRED_USE mechanism to determine at dependency resolution time if this ebuild can satisfy RUBY_TARGETS. Patch by Matthew Schultz in bug 373227.

1 a3li 1.6 # Copyright 1999-2009 Gentoo Foundation
2 graaff 1.1 # Distributed under the terms of the GNU General Public License v2
3 graaff 1.36 # $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.35 2011/07/19 05:48:09 graaff Exp $
4 graaff 1.1 #
5     # @ECLASS: ruby-ng.eclass
6     # @MAINTAINER:
7     # Ruby herd <ruby@gentoo.org>
8     #
9     # Author: Diego E. Pettenò <flameeyes@gentoo.org>
10     #
11     # Author: Alex Legler <a3li@gentoo.org>
12     #
13     # Author: Hans de Graaff <graaff@gentoo.org>
14     #
15     # @BLURB: An eclass for installing Ruby packages with proper support for multiple Ruby slots.
16     # @DESCRIPTION:
17     # The Ruby eclass is designed to allow an easier installation of Ruby packages
18     # and their incorporation into the Gentoo Linux system.
19     #
20     # Currently available targets are:
21     # * ruby18 - Ruby (MRI) 1.8.x
22     # * ruby19 - Ruby (MRI) 1.9.x
23     # * ree18 - Ruby Enterprise Edition 1.8.x
24     # * jruby - JRuby
25     #
26     # This eclass does not define the implementation of the configure,
27     # compile, test, or install phases. Instead, the default phases are
28     # used. Specific implementations of these phases can be provided in
29     # the ebuild either to be run for each Ruby implementation, or for all
30     # Ruby implementations, as follows:
31     #
32     # * each_ruby_configure
33     # * all_ruby_configure
34    
35     # @ECLASS-VARIABLE: USE_RUBY
36 graaff 1.26 # @REQUIRED
37 graaff 1.1 # @DESCRIPTION:
38     # This variable contains a space separated list of targets (see above) a package
39     # is compatible to. It must be set before the `inherit' call. There is no
40     # default. All ebuilds are expected to set this variable.
41    
42     # @ECLASS-VARIABLE: RUBY_PATCHES
43 graaff 1.26 # @DEFAULT_UNSET
44 graaff 1.1 # @DESCRIPTION:
45     # A String or Array of filenames of patches to apply to all implementations.
46    
47     # @ECLASS-VARIABLE: RUBY_OPTIONAL
48     # @DESCRIPTION:
49     # Set the value to "yes" to make the dependency on a Ruby interpreter optional.
50    
51 graaff 1.31 # @ECLASS-VARIABLE: RUBY_S
52     # @DEFAULT_UNSET
53     # @DESCRIPTION:
54     # If defined this variable determines the source directory name after
55     # unpacking. This defaults to the name of the package. Note that this
56     # variable supports a wildcard mechanism to help with github tarballs
57     # that contain the commit hash as part of the directory name.
58    
59 graaff 1.34 # @ECLASS-VARIABLE: RUBY_QA_ALLOWED_LIBS
60     # @DEFAULT_UNSET
61     # @DESCRIPTION:
62     # If defined this variable contains a whitelist of shared objects that
63     # are allowed to exist even if they don't link to libruby. This avoids
64     # the QA check that makes this mandatory. This is most likely not what
65     # you are looking for if you get the related "Missing links" QA warning,
66     # since the proper fix is almost always to make sure the shared object
67     # is linked against libruby. There are cases were this is not the case
68     # and the shared object is generic code to be used in some other way
69     # (e.g. selenium's firefox driver extension). When set this argument is
70     # passed to "grep -E" to remove reporting of these shared objects.
71    
72 graaff 1.1 inherit eutils toolchain-funcs
73    
74     EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_setup
75    
76     case ${EAPI} in
77     0|1)
78     die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;;
79 flameeyes 1.24 2|3) ;;
80 graaff 1.31 4)
81     # S is no longer automatically assigned when it doesn't exist.
82     S="${WORKDIR}"
83     ;;
84 graaff 1.1 *)
85     die "Unknown EAPI=${EAPI} for ruby-ng.eclass"
86     esac
87    
88     # @FUNCTION: ruby_implementation_depend
89     # @USAGE: target [comparator [version]]
90     # @RETURN: Package atom of a Ruby implementation to be used in dependencies.
91     # @DESCRIPTION:
92     # This function returns the formal package atom for a Ruby implementation.
93     #
94     # `target' has to be one of the valid values for USE_RUBY (see above)
95     #
96     # Set `comparator' and `version' to include a comparator (=, >=, etc.) and a
97     # version string to the returned string
98     ruby_implementation_depend() {
99     local rubypn=
100     local rubyslot=
101    
102     case $1 in
103     ruby18)
104     rubypn="dev-lang/ruby"
105     rubyslot=":1.8"
106     ;;
107     ruby19)
108     rubypn="dev-lang/ruby"
109     rubyslot=":1.9"
110     ;;
111     ree18)
112     rubypn="dev-lang/ruby-enterprise"
113     rubyslot=":1.8"
114     ;;
115     jruby)
116     rubypn="dev-java/jruby"
117     rubyslot=""
118     ;;
119     *) die "$1: unknown Ruby implementation"
120     esac
121    
122     echo "$2${rubypn}$3${rubyslot}"
123     }
124    
125     # @FUNCTION: ruby_samelib
126     # @RETURN: use flag string with current ruby implementations
127     # @DESCRIPTION:
128     # Convenience function to output the use dependency part of a
129     # dependency. Used as a building block for ruby_add_rdepend() and
130     # ruby_add_bdepend(), but may also be useful in an ebuild to specify
131     # more complex dependencies.
132     ruby_samelib() {
133     local res=
134     for _ruby_implementation in $USE_RUBY; do
135     has -${_ruby_implementation} $@ || \
136     res="${res}ruby_targets_${_ruby_implementation}?,"
137     done
138    
139     echo "[${res%,}]"
140     }
141    
142 flameeyes 1.17 _ruby_atoms_samelib_generic() {
143 flameeyes 1.18 eshopts_push -o noglob
144 flameeyes 1.17 echo "RUBYTARGET? ("
145 flameeyes 1.14 for token in $*; do
146     case "$token" in
147 flameeyes 1.16 "||" | "(" | ")" | *"?")
148 flameeyes 1.14 echo "${token}" ;;
149 flameeyes 1.21 *])
150     echo "${token%[*}[RUBYTARGET,${token/*[}" ;;
151 flameeyes 1.14 *)
152 flameeyes 1.17 echo "${token}[RUBYTARGET]" ;;
153 flameeyes 1.14 esac
154     done
155 flameeyes 1.17 echo ")"
156 flameeyes 1.18 eshopts_pop
157 flameeyes 1.17 }
158    
159 flameeyes 1.27 # @FUNCTION: ruby_implementation_command
160     # @RETURN: the path to the given ruby implementation
161     # @DESCRIPTION:
162     # Not all implementations have the same command basename as the
163     # target; namely Ruby Enterprise 1.8 uses ree18 and rubyee18
164     # respectively. This function translate between the two
165     ruby_implementation_command() {
166     local _ruby_name=$1
167    
168     # Add all USE_RUBY values where the flag name diverts from the binary here
169     case $1 in
170     ree18)
171     _ruby_name=rubyee18
172     ;;
173     esac
174    
175     echo $(type -p ${_ruby_name} 2>/dev/null)
176     }
177    
178 flameeyes 1.17 _ruby_atoms_samelib() {
179     local atoms=$(_ruby_atoms_samelib_generic "$*")
180    
181     for _ruby_implementation in $USE_RUBY; do
182     echo "${atoms//RUBYTARGET/ruby_targets_${_ruby_implementation}}"
183     done
184 flameeyes 1.14 }
185    
186 flameeyes 1.16 _ruby_wrap_conditions() {
187     local conditions="$1"
188     local atoms="$2"
189    
190     for condition in $conditions; do
191     atoms="${condition}? ( ${atoms} )"
192     done
193    
194     echo "$atoms"
195     }
196    
197 graaff 1.1 # @FUNCTION: ruby_add_rdepend
198 flameeyes 1.16 # @USAGE: dependencies
199 graaff 1.1 # @DESCRIPTION:
200 flameeyes 1.16 # Adds the specified dependencies, with use condition(s) to RDEPEND,
201     # taking the current set of ruby targets into account. This makes sure
202     # that all ruby dependencies of the package are installed for the same
203     # ruby targets. Use this function for all ruby dependencies instead of
204     # setting RDEPEND yourself. The list of atoms uses the same syntax as
205     # normal dependencies.
206     #
207     # Note: runtime dependencies are also added as build-time test
208     # dependencies.
209 graaff 1.1 ruby_add_rdepend() {
210     case $# in
211 flameeyes 1.16 1) ;;
212 graaff 1.1 2)
213 flameeyes 1.16 [[ "${GENTOO_DEV}" == "yes" ]] && eqawarn "You can now use the usual syntax in ruby_add_rdepend for $CATEGORY/$PF"
214     ruby_add_rdepend "$(_ruby_wrap_conditions "$1" "$2")"
215     return
216 graaff 1.1 ;;
217     *)
218     die "bad number of arguments to $0"
219     ;;
220     esac
221    
222 flameeyes 1.16 local dependency=$(_ruby_atoms_samelib "$1")
223    
224     RDEPEND="${RDEPEND} $dependency"
225    
226     # Add the dependency as a test-dependency since we're going to
227     # execute the code during test phase.
228 flameeyes 1.20 DEPEND="${DEPEND} test? ( ${dependency} )"
229 ssuominen 1.33 has test "$IUSE" || IUSE="${IUSE} test"
230 graaff 1.1 }
231    
232     # @FUNCTION: ruby_add_bdepend
233 flameeyes 1.16 # @USAGE: dependencies
234 graaff 1.1 # @DESCRIPTION:
235 flameeyes 1.16 # Adds the specified dependencies, with use condition(s) to DEPEND,
236     # taking the current set of ruby targets into account. This makes sure
237     # that all ruby dependencies of the package are installed for the same
238     # ruby targets. Use this function for all ruby dependencies instead of
239     # setting DEPEND yourself. The list of atoms uses the same syntax as
240     # normal dependencies.
241 graaff 1.1 ruby_add_bdepend() {
242     case $# in
243 flameeyes 1.16 1) ;;
244 graaff 1.1 2)
245 flameeyes 1.16 [[ "${GENTOO_DEV}" == "yes" ]] && eqawarn "You can now use the usual syntax in ruby_add_bdepend for $CATEGORY/$PF"
246     ruby_add_bdepend "$(_ruby_wrap_conditions "$1" "$2")"
247     return
248 graaff 1.1 ;;
249     *)
250     die "bad number of arguments to $0"
251     ;;
252     esac
253    
254 flameeyes 1.16 local dependency=$(_ruby_atoms_samelib "$1")
255    
256     DEPEND="${DEPEND} $dependency"
257 flameeyes 1.19 RDEPEND="${RDEPEND}"
258 graaff 1.1 }
259    
260 graaff 1.36 # @FUNCTION: ruby_get_use_targets
261     # @DESCRIPTION:
262     # Gets an array of ruby use targets that the ebuild sets
263     ruby_get_use_targets() {
264     local t implementation
265     for implementation in ${USE_RUBY}; do
266     t+=" ruby_targets_${implementation}"
267     done
268     echo $t
269     }
270    
271     if [[ ${EAPI:-0} -ge 4 && ${RUBY_OPTIONAL} != "yes" ]]; then
272     REQUIRED_USE=" || ( $(ruby_get_use_targets) )"
273     fi
274    
275 graaff 1.1 for _ruby_implementation in $USE_RUBY; do
276     IUSE="${IUSE} ruby_targets_${_ruby_implementation}"
277    
278     # If you specify RUBY_OPTIONAL you also need to take care of
279     # ruby useflag and dependency.
280     if [[ ${RUBY_OPTIONAL} != "yes" ]]; then
281     DEPEND="${DEPEND} ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )"
282     RDEPEND="${RDEPEND} ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )"
283     fi
284     done
285    
286     _ruby_invoke_environment() {
287     old_S=${S}
288 graaff 1.31 case ${EAPI} in
289     4)
290 graaff 1.32 if [ -z ${RUBY_S} ]; then
291     sub_S=${P}
292     else
293     sub_S=${RUBY_S}
294     fi
295 graaff 1.31 ;;
296     *)
297     sub_S=${S#${WORKDIR}/}
298     ;;
299     esac
300 flameeyes 1.12
301     # Special case, for the always-lovely GitHub fetches. With this,
302     # we allow the star glob to just expand to whatever directory it's
303     # called.
304 flameeyes 1.28 if [[ ${sub_S} = *"*"* ]]; then
305 graaff 1.35 case ${EAPI} in
306     2|3)
307     #The old method of setting S depends on undefined package
308     # manager behaviour, so encourage upgrading to EAPI=4.
309     eqawarn "Using * expansion of S is deprecated. Use EAPI and RUBY_S instead."
310     ;;
311     esac
312 flameeyes 1.12 pushd "${WORKDIR}"/all &>/dev/null
313 flameeyes 1.13 sub_S=$(eval ls -d ${sub_S} 2>/dev/null)
314 flameeyes 1.12 popd &>/dev/null
315     fi
316 graaff 1.1
317     environment=$1; shift
318    
319     my_WORKDIR="${WORKDIR}"/${environment}
320     S="${my_WORKDIR}"/"${sub_S}"
321    
322     if [[ -d "${S}" ]]; then
323     pushd "$S" &>/dev/null
324     elif [[ -d "${my_WORKDIR}" ]]; then
325     pushd "${my_WORKDIR}" &>/dev/null
326     else
327     pushd "${WORKDIR}" &>/dev/null
328     fi
329    
330     ebegin "Running ${_PHASE:-${EBUILD_PHASE}} phase for $environment"
331     "$@"
332     popd &>/dev/null
333    
334     S=${old_S}
335     }
336    
337     _ruby_each_implementation() {
338     local invoked=no
339     for _ruby_implementation in ${USE_RUBY}; do
340     # only proceed if it's requested
341     use ruby_targets_${_ruby_implementation} || continue
342    
343 flameeyes 1.27 RUBY=$(ruby_implementation_command ${_ruby_implementation})
344 graaff 1.1 invoked=yes
345    
346     if [[ -n "$1" ]]; then
347 flameeyes 1.27 _ruby_invoke_environment ${_ruby_implementation} "$@"
348 graaff 1.1 fi
349    
350     unset RUBY
351     done
352    
353     [[ ${invoked} == "no" ]] && die "You need to select at least one Ruby implementation by setting RUBY_TARGETS in /etc/make.conf."
354     }
355    
356     # @FUNCTION: ruby-ng_pkg_setup
357     # @DESCRIPTION:
358     # Check whether at least one ruby target implementation is present.
359     ruby-ng_pkg_setup() {
360     # This only checks that at least one implementation is present
361     # before doing anything; by leaving the parameters empty we know
362     # it's a special case.
363     _ruby_each_implementation
364     }
365    
366     # @FUNCTION: ruby-ng_src_unpack
367     # @DESCRIPTION:
368 graaff 1.5 # Unpack the source archive.
369 graaff 1.1 ruby-ng_src_unpack() {
370     mkdir "${WORKDIR}"/all
371     pushd "${WORKDIR}"/all &>/dev/null
372    
373     # We don't support an each-unpack, it's either all or nothing!
374     if type all_ruby_unpack &>/dev/null; then
375     _ruby_invoke_environment all all_ruby_unpack
376     else
377     [[ -n ${A} ]] && unpack ${A}
378     fi
379    
380     popd &>/dev/null
381     }
382    
383     _ruby_apply_patches() {
384     for patch in "${RUBY_PATCHES[@]}"; do
385     if [ -f "${patch}" ]; then
386     epatch "${patch}"
387     elif [ -f "${FILESDIR}/${patch}" ]; then
388     epatch "${FILESDIR}/${patch}"
389     else
390     die "Cannot find patch ${patch}"
391     fi
392     done
393    
394     # This is a special case: instead of executing just in the special
395     # "all" environment, this will actually copy the effects on _all_
396     # the other environments, and is thus executed before the copy
397     type all_ruby_prepare &>/dev/null && all_ruby_prepare
398     }
399    
400     _ruby_source_copy() {
401     # Until we actually find a reason not to, we use hardlinks, this
402     # should reduce the amount of disk space that is wasted by this.
403 fauli 1.30 cp -prl all ${_ruby_implementation} \
404 graaff 1.1 || die "Unable to copy ${_ruby_implementation} environment"
405     }
406    
407     # @FUNCTION: ruby-ng_src_prepare
408     # @DESCRIPTION:
409     # Apply patches and prepare versions for each ruby target
410     # implementation. Also carry out common clean up tasks.
411     ruby-ng_src_prepare() {
412     # Way too many Ruby packages are prepared on OSX without removing
413     # the extra data forks, we do it here to avoid repeating it for
414     # almost every other ebuild.
415     find . -name '._*' -delete
416    
417     _ruby_invoke_environment all _ruby_apply_patches
418    
419 flameeyes 1.7 _PHASE="source copy" \
420     _ruby_each_implementation _ruby_source_copy
421 graaff 1.1
422     if type each_ruby_prepare &>/dev/null; then
423     _ruby_each_implementation each_ruby_prepare
424     fi
425     }
426    
427     # @FUNCTION: ruby-ng_src_configure
428     # @DESCRIPTION:
429     # Configure the package.
430     ruby-ng_src_configure() {
431     if type each_ruby_configure &>/dev/null; then
432     _ruby_each_implementation each_ruby_configure
433     fi
434    
435     type all_ruby_configure &>/dev/null && \
436     _ruby_invoke_environment all all_ruby_configure
437     }
438    
439     # @FUNCTION: ruby-ng_src_compile
440     # @DESCRIPTION:
441     # Compile the package.
442     ruby-ng_src_compile() {
443     if type each_ruby_compile &>/dev/null; then
444     _ruby_each_implementation each_ruby_compile
445     fi
446    
447     type all_ruby_compile &>/dev/null && \
448     _ruby_invoke_environment all all_ruby_compile
449     }
450    
451     # @FUNCTION: ruby-ng_src_test
452     # @DESCRIPTION:
453     # Run tests for the package.
454     ruby-ng_src_test() {
455     if type each_ruby_test &>/dev/null; then
456     _ruby_each_implementation each_ruby_test
457     fi
458    
459     type all_ruby_test &>/dev/null && \
460     _ruby_invoke_environment all all_ruby_test
461     }
462    
463     _each_ruby_check_install() {
464 flameeyes 1.24 local scancmd=scanelf
465     # we have a Mach-O object here
466     [[ ${CHOST} == *-darwin ]] && scancmd=scanmacho
467    
468     has "${EAPI}" 2 && ! use prefix && EPREFIX=
469    
470 graaff 1.1 local libruby_basename=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["LIBRUBY_SO"]')
471 flameeyes 1.25 local libruby_soname=$(basename $(${scancmd} -F "%S#F" -qS "${EPREFIX}/usr/$(get_libdir)/${libruby_basename}") 2>/dev/null)
472 flameeyes 1.2 local sitedir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitedir"]')
473     local sitelibdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitelibdir"]')
474    
475     # Look for wrong files in sitedir
476 flameeyes 1.22 # if [[ -d "${D}${sitedir}" ]]; then
477     # local f=$(find "${D}${sitedir}" -mindepth 1 -maxdepth 1 -not -wholename "${D}${sitelibdir}")
478     # if [[ -n ${f} ]]; then
479     # eerror "Found files in sitedir, outsite sitelibdir:"
480     # eerror "${f}"
481     # die "Misplaced files in sitedir"
482     # fi
483     # fi
484 graaff 1.1
485     # The current implementation lacks libruby (i.e.: jruby)
486     [[ -z ${libruby_soname} ]] && return 0
487    
488 flameeyes 1.23 # Check also the gems directory, since we could be installing compiled
489     # extensions via ruby-fakegem; make sure to check only in sitelibdir, since
490     # that's what changes between two implementations (otherwise you'd get false
491     # positives now that Ruby 1.9.2 installs with the same sitedir as 1.8)
492 flameeyes 1.24 ${scancmd} -qnR "${D}${sitelibdir}" "${D}${sitelibdir/site_ruby/gems}" \
493 graaff 1.1 | fgrep -v "${libruby_soname}" \
494 graaff 1.34 | grep -E -v "${RUBY_QA_ALLOWED_LIBS}" \
495 graaff 1.1 > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log
496    
497     if [[ -s "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ]]; then
498 flameeyes 1.15 ewarn "Extensions installed for ${_ruby_implementation} with missing links to ${libruby_soname}"
499 graaff 1.1 ewarn $(< "${T}"/ruby-ng-${_ruby_implementation}-mislink.log )
500 flameeyes 1.15 die "Missing links to ${libruby_soname}"
501 graaff 1.1 fi
502     }
503    
504     # @FUNCTION: ruby-ng_src_install
505     # @DESCRIPTION:
506     # Install the package for each ruby target implementation.
507     ruby-ng_src_install() {
508     if type each_ruby_install &>/dev/null; then
509     _ruby_each_implementation each_ruby_install
510     fi
511    
512     type all_ruby_install &>/dev/null && \
513     _ruby_invoke_environment all all_ruby_install
514    
515     _PHASE="check install" \
516     _ruby_each_implementation _each_ruby_check_install
517     }
518    
519 a3li 1.11 # @FUNCTION: ruby_rbconfig_value
520     # @USAGE: rbconfig item
521     # @RETURN: Returns the value of the given rbconfig item of the Ruby interpreter in ${RUBY}.
522     ruby_rbconfig_value() {
523     echo $(${RUBY} -rrbconfig -e "puts Config::CONFIG['$1']")
524     }
525    
526 graaff 1.1 # @FUNCTION: doruby
527     # @USAGE: file [file...]
528     # @DESCRIPTION:
529     # Installs the specified file(s) into the sitelibdir of the Ruby interpreter in ${RUBY}.
530     doruby() {
531 flameeyes 1.4 [[ -z ${RUBY} ]] && die "\$RUBY is not set"
532 flameeyes 1.24 has "${EAPI}" 2 && ! use prefix && EPREFIX=
533 graaff 1.1 ( # don't want to pollute calling env
534 flameeyes 1.24 sitelibdir=$(ruby_rbconfig_value 'sitelibdir')
535     insinto ${sitelibdir#${EPREFIX}}
536 graaff 1.1 insopts -m 0644
537     doins "$@"
538     ) || die "failed to install $@"
539     }
540    
541     # @FUNCTION: ruby_get_libruby
542     # @RETURN: The location of libruby*.so belonging to the Ruby interpreter in ${RUBY}.
543     ruby_get_libruby() {
544     ${RUBY} -rrbconfig -e 'puts File.join(Config::CONFIG["libdir"], Config::CONFIG["LIBRUBY"])'
545     }
546    
547     # @FUNCTION: ruby_get_hdrdir
548     # @RETURN: The location of the header files belonging to the Ruby interpreter in ${RUBY}.
549     ruby_get_hdrdir() {
550 a3li 1.11 local rubyhdrdir=$(ruby_rbconfig_value 'rubyhdrdir')
551 graaff 1.1
552     if [[ "${rubyhdrdir}" = "nil" ]] ; then
553 a3li 1.11 rubyhdrdir=$(ruby_rbconfig_value 'archdir')
554 graaff 1.1 fi
555    
556     echo "${rubyhdrdir}"
557     }
558 a3li 1.10
559     # @FUNCTION: ruby_get_version
560     # @RETURN: The version of the Ruby interpreter in ${RUBY}, or what 'ruby' points to.
561     ruby_get_version() {
562     local ruby=${RUBY:-$(type -p ruby 2>/dev/null)}
563    
564     echo $(${ruby} -e 'puts RUBY_VERSION')
565     }
566    
567     # @FUNCTION: ruby_get_implementation
568     # @RETURN: The implementation of the Ruby interpreter in ${RUBY}, or what 'ruby' points to.
569     ruby_get_implementation() {
570     local ruby=${RUBY:-$(type -p ruby 2>/dev/null)}
571    
572     case $(${ruby} --version) in
573     *Enterprise*)
574     echo "ree"
575     ;;
576     *jruby*)
577     echo "jruby"
578     ;;
579     *)
580     echo "mri"
581     ;;
582     esac
583     }

  ViewVC Help
Powered by ViewVC 1.1.20