ruby-install
ruby-install copied to clipboard
ruby-install symlink in ~/bin
Currently this doesn't work because it looks for ~/share (which I don't want to put there).
Solvable by replacing $0 with $(readlink -f $0) in line 5 of ruby-install.
Can't see how it would break any (sane) existing use cases.
Actually, on OSX their readlink doesn't support -f. How about installing into ~/.local?
Here is what I have for readlink:

Mac OS X, Version 10.7.5
Interesting take on dealing with BSD readlink not dereferencing symlinks here: https://github.com/nicholasrobinson/JSON.sh/blob/master/bin/json_parse
Adapted from ^ code, we could do something like:
function canonical_readlink()
{
cd "$(dirname "$1")";
local filename="$(basename "$1")";
if [[ -h "$filename" ]]; then
canonical_readlink "$(readlink "$filename")";
else
echo "$(pwd -P)/"$filename"";
fi
}
Given that I don't particularly see the need to worry about directory symlinks (if an entire directory has been symlinked it seems fair to assume others will as well), why not turn the $0 into
$( ([[ -h $0 ]] && readlink $0) || echo $0 )
So the line becomes
source "$(dirname $(dirname $( ([[ -h $0 ]] && readlink $0) || echo $0 ) ))/share/ruby-install/ruby-install.sh"
On the subject of installing to .local, that does work and it may come to that, but I prefer to keep executables with the rest of their files where possible and just symlink them.