diff options
author | Mamoru Komachi <usata@gentoo.org> | 2004-01-29 18:02:25 +0000 |
---|---|---|
committer | Mamoru Komachi <usata@gentoo.org> | 2004-01-29 18:02:25 +0000 |
commit | d4a1d5eecbbd97d0776aa6650618c9b0e86d315d (patch) | |
tree | 9bbe22e408cd9a1c62ebe9f79e5a969cb8023114 /dev-ruby/ruby-config | |
parent | Initial import. Derived from dev-lang/ruby to cope with dev-lang/ruby-cvs (diff) | |
download | gentoo-2-d4a1d5eecbbd97d0776aa6650618c9b0e86d315d.tar.gz gentoo-2-d4a1d5eecbbd97d0776aa6650618c9b0e86d315d.tar.bz2 gentoo-2-d4a1d5eecbbd97d0776aa6650618c9b0e86d315d.zip |
Initial import. Derived from dev-lang/ruby to cope with dev-lang/ruby-cvs
Diffstat (limited to 'dev-ruby/ruby-config')
-rw-r--r-- | dev-ruby/ruby-config/ChangeLog | 10 | ||||
-rw-r--r-- | dev-ruby/ruby-config/Manifest | 6 | ||||
-rw-r--r-- | dev-ruby/ruby-config/files/digest-ruby-config-0.1 | 0 | ||||
-rw-r--r-- | dev-ruby/ruby-config/files/ruby-config.sh | 121 | ||||
-rw-r--r-- | dev-ruby/ruby-config/metadata.xml | 5 | ||||
-rw-r--r-- | dev-ruby/ruby-config/ruby-config-0.1.ebuild | 23 |
6 files changed, 163 insertions, 2 deletions
diff --git a/dev-ruby/ruby-config/ChangeLog b/dev-ruby/ruby-config/ChangeLog new file mode 100644 index 000000000000..971c2843fc21 --- /dev/null +++ b/dev-ruby/ruby-config/ChangeLog @@ -0,0 +1,10 @@ +# ChangeLog for dev-ruby/ruby-config +# Copyright 2000-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/dev-ruby/ruby-config/ChangeLog,v 1.1 2004/01/29 18:02:15 usata Exp $ + +*ruby-config-0.1 (30 Jan 2004) + + 30 Jan 2004; Mamoru KOMACHI <usata@gentoo.org> metadata.xml, + ruby-config-0.1.ebuild, files/ruby-config.sh: + Initial import. Derived from dev-lang/ruby to cope with dev-lang/ruby-cvs + diff --git a/dev-ruby/ruby-config/Manifest b/dev-ruby/ruby-config/Manifest index 8d52e1b3dddf..9c343022fe5b 100644 --- a/dev-ruby/ruby-config/Manifest +++ b/dev-ruby/ruby-config/Manifest @@ -1,3 +1,5 @@ -MD5 44bf9c6d576ce8ac98c7349f4e1552f0 ruby-config-0.1.ebuild 401 -MD5 8ea6a43eeadeddb729be76cdeb0071e6 files/ruby-config.sh 2687 +MD5 c0dc43ce1cdc886398474eb7dee23d86 ruby-config-0.1.ebuild 554 +MD5 3eec9f3fe48b51f49dbc1f171a3b026f metadata.xml 157 +MD5 6971b94ca2ef7c9e879f943740460674 ChangeLog 441 +MD5 af894dcb3f8043fd0e06b74dd4919045 files/ruby-config.sh 2697 MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-ruby-config-0.1 0 diff --git a/dev-ruby/ruby-config/files/digest-ruby-config-0.1 b/dev-ruby/ruby-config/files/digest-ruby-config-0.1 new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/dev-ruby/ruby-config/files/digest-ruby-config-0.1 diff --git a/dev-ruby/ruby-config/files/ruby-config.sh b/dev-ruby/ruby-config/files/ruby-config.sh new file mode 100644 index 000000000000..e6b626430929 --- /dev/null +++ b/dev-ruby/ruby-config/files/ruby-config.sh @@ -0,0 +1,121 @@ +#!/bin/bash + +# Copyright 1999-2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-ruby/ruby-config/files/ruby-config.sh,v 1.1 2004/01/29 18:02:15 usata Exp $ + +# Author: Mamoru KOMACHI <usata@gentoo.org> + +if [ -z "${PORTDIR}" ] ; then + [ -r /etc/make.conf ] && source /etc/make.conf + if [ -z "${PORTDIR}" ] ; then + [ -r /etc/make.globals ] && source /etc/make.globals + fi +fi + +if [ -r /etc/init.d/functions.sh ] ; then + source /etc/init.d/functions.sh +else + echo "Could not find /etc/init.d/functions.sh" + exit 1 +fi + +#dummy function +EXPORT_FUNCTIONS() { :; } + +if [ -r ${PORTDIR:-/usr/portage}/eclass/alternatives.eclass ] ; then + source ${PORTDIR:-/usr/portage}/eclass/alternatives.eclass +else + echo "Could not find ${PORTDIR:-/usr/portage}/bin/ebuild.sh" + exit 1 +fi + +usage() { +cat << "USAGE_END" +Usage: ruby-config [Option] [Ruby Profile] +Change the current ruby profile, or give info about profiles. + +Options: + + -c, --get-current-profile + Print current used ruby profile. + -l, --list-profiles + List available ruby profiles. + -h, --show-help + Print this help. + +The profile name is either ruby16, ruby18 or ruby19. + +USAGE_END +exit 1 +} + +if [ "$#" -lt 1 ] ; then + usage +fi + +switch_profile() { + if [ "$EUID" != 0 ] ; then + eerror "You need root privilege to switch profile." + exit 1 + fi + if [ -x /usr/bin/"$1" -a "$1" != "ruby" ] ; then + local suf=${1/ruby/} + for i in ruby irb erb testrb rdoc ri ; do + alternatives_makesym \ + /usr/bin/$i /usr/bin/$i{$suf,18,16,19} + done + alternatives_makesym \ + /usr/lib/libruby.so /usr/lib/libruby{$suf,18.16,19}.so + alternatives_makesym \ + /usr/share/man/man1/ruby.1.gz \ + /usr/share/man/man1/ruby{$suf,18,16,19}.1.gz + else + eerror "Unsupported profile." + fi +} + +get_current_profile() { + if [ ! -L /usr/bin/ruby ] ; then + eerror "Your ruby doesn't seem to support SLOT." + exit 1 + fi + einfo "Your current profile refers to $(readlink /usr/bin/ruby)." +} + +list_profiles() { + einfo "Supported profiles are:" + for f in /usr/bin/ruby[0-9][0-9] ; do + einfo "\t${f#/usr/bin/}" + done + einfo "You can specify one of the profiles listed above." + einfo "e.g.) ruby-config ruby16" +} + +for x in $* ; do + if [ "$#" -gt 1 ] ; then + eerror "ruby-config accepts only one argument." + eerror "Run $0 -h for help." + exit 1 + fi + case "${x}" in + -c|--get-current-profile) + get_current_profile + ;; + -h|--show-help) + usage + ;; + -l|--list-profiles) + list_profiles + ;; + -*) + eerror "Invalid option. Run $0 -h for help." + exit 1 + ;; + *) + switch_profile $* + ;; + esac + + exit 0 +done diff --git a/dev-ruby/ruby-config/metadata.xml b/dev-ruby/ruby-config/metadata.xml new file mode 100644 index 000000000000..852136183369 --- /dev/null +++ b/dev-ruby/ruby-config/metadata.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>ruby</herd> +</pkgmetadata> diff --git a/dev-ruby/ruby-config/ruby-config-0.1.ebuild b/dev-ruby/ruby-config/ruby-config-0.1.ebuild new file mode 100644 index 000000000000..9e48edef45d1 --- /dev/null +++ b/dev-ruby/ruby-config/ruby-config-0.1.ebuild @@ -0,0 +1,23 @@ +# Copyright 1999-2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-ruby/ruby-config/ruby-config-0.1.ebuild,v 1.1 2004/01/29 18:02:15 usata Exp $ + +DESCRIPTION="Utility to switch the ruby interpreter beging used" +HOMEPAGE="http://www.gentoo.org/" +SRC_URI="" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86 ~alpha" + +IUSE="" + +DEPEND="dev-lang/ruby" +#RDEPEND="" + +src_install() { + + newsbin ${FILESDIR}/ruby-config.sh ruby-config + dodir /usr/bin + dosym /usr/{s,}bin/ruby-config +} |