diff options
author | Alex Legler <a3li@gentoo.org> | 2010-04-05 07:41:09 +0000 |
---|---|---|
committer | Alex Legler <a3li@gentoo.org> | 2010-04-05 07:41:09 +0000 |
commit | 91ac0b1a9e58de3638f7ac47edac39593389c297 (patch) | |
tree | a0c5fba1cc174e6a9bb6ca6e91450f72cadbcb98 /eclass | |
parent | add ~arm, bug #293671 (diff) | |
download | gentoo-2-91ac0b1a9e58de3638f7ac47edac39593389c297.tar.gz gentoo-2-91ac0b1a9e58de3638f7ac47edac39593389c297.tar.bz2 gentoo-2-91ac0b1a9e58de3638f7ac47edac39593389c297.zip |
Add ruby_get_version() and ruby_get_implementation() convenience helper functions
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ruby-ng.eclass | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass index 407e3077f0b5..b8cb5d60ab12 100644 --- a/eclass/ruby-ng.eclass +++ b/eclass/ruby-ng.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.9 2010/04/02 20:26:21 a3li Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.10 2010/04/05 07:41:09 a3li Exp $ # # @ECLASS: ruby-ng.eclass # @MAINTAINER: @@ -448,3 +448,29 @@ ruby_get_hdrdir() { echo "${rubyhdrdir}" } + +# @FUNCTION: ruby_get_version +# @RETURN: The version of the Ruby interpreter in ${RUBY}, or what 'ruby' points to. +ruby_get_version() { + local ruby=${RUBY:-$(type -p ruby 2>/dev/null)} + + echo $(${ruby} -e 'puts RUBY_VERSION') +} + +# @FUNCTION: ruby_get_implementation +# @RETURN: The implementation of the Ruby interpreter in ${RUBY}, or what 'ruby' points to. +ruby_get_implementation() { + local ruby=${RUBY:-$(type -p ruby 2>/dev/null)} + + case $(${ruby} --version) in + *Enterprise*) + echo "ree" + ;; + *jruby*) + echo "jruby" + ;; + *) + echo "mri" + ;; + esac +} |