Created
August 2, 2009 06:35
-
-
Save wishdev/159957 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ruby.eselect-20090723 2009-07-23 19:02:39.000000000 -0700 | |
+++ /usr/share/eselect/modules/ruby.eselect 2009-08-01 23:34:39.814660501 -0700 | |
@@ -12,7 +12,7 @@ | |
find_targets() { | |
for t in ${ROOT}${bindir}/${1:-ruby}{18,19,1.9,2.0,ee} ; do | |
- [[ -e $t ]] || continue | |
+ [[ -e $t && ! -h $t ]] || continue | |
echo ${t} | |
done | |
} | |
@@ -41,8 +41,22 @@ | |
} | |
remove_symlinks() { | |
- rm -f ${ROOT}${bindir}/{ruby,gem,irb,erb,ri,rdoc,testrb} && \ | |
+ local target=${1} version | |
+ local path="${ROOT}${bindir}/" | |
+ | |
+ version=${target##*ruby} | |
+ short_version=${version/./} | |
+ | |
+ rm -f ${path}{ruby,gem,irb,erb,ri,rdoc,testrb} && \ | |
rm -f ${ROOT}${man1dir}/ruby.{1,1.gz,1.bz2,1.lzma} | |
+ | |
+ if [ "${version}" != "${short_version}" ]; then | |
+ for f in "ruby" "gem" "irb" "erb" "ri" "testrb" "rdoc" ; do | |
+ if [[ -h "${path}${f}${short_version}" ]] ; then | |
+ rm -f "${path}${f}${short_version}" | |
+ fi | |
+ done | |
+ fi | |
} | |
create_man_symlinks() { | |
@@ -63,18 +77,27 @@ | |
local target=${1} version | |
version=${target##*ruby} | |
- | |
+ short_version=${version/./} | |
+ | |
local path="${ROOT}${bindir}/" | |
# these have to work | |
for f in "ruby" "irb" "erb" "ri" "testrb" "rdoc" ; do | |
ln -s "${path}${f}${version}" "${path}${f}" || \ | |
die -q "Could not set ${f} symlink" | |
+ if [ "${version}" != "${short_version}" ]; then | |
+ ln -s "${path}${f}${version}" "${path}${f}${short_version}" || \ | |
+ die -q "Could not set ${f}${short_version} symlink" | |
+ fi | |
done | |
# these can fail | |
if [[ -e "${path}gem${version}" ]] ; then | |
ln -s "${path}gem${version}" "${path}gem" || \ | |
die -q "Could not set gem symlink" | |
+ if [ "${version}" != "${short_version}" ]; then | |
+ ln -s "${path}gem${version}" "${path}gem${short_version}" || \ | |
+ die -q "Could not set gem${short_version} symlink" | |
+ fi | |
else | |
write_warning_msg "Could not set gem symlink" | |
echo "It appears you do not have RubyGems installed for this profile." | |
@@ -172,7 +195,7 @@ | |
local target=$(check_target ${1}) | |
- remove_symlinks || \ | |
+ remove_symlinks ${target} || \ | |
die -q "Could not remove symlinks" | |
create_symlinks ${target} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment