2014-12-07 05:13:45 +00:00
|
|
|
set -l rbenv_dir "$RBENV_ROOT"
|
|
|
|
if [ ! $rbenv_dir ]
|
|
|
|
set rbenv_dir $HOME/.rbenv
|
|
|
|
end
|
|
|
|
|
|
|
|
set -l supports_fish
|
|
|
|
set -l supports_fish_version '0.4.0'
|
|
|
|
set -l user_version (eval $rbenv_dir/bin/rbenv --version | sed -E 's/^rbenv ([[:digit:]\.]{2,}).*$/\1/g')
|
|
|
|
|
|
|
|
if [ $user_version = $supports_fish_version ]
|
|
|
|
set -l supports_fish_commits '56'
|
|
|
|
set -l user_commits (eval $rbenv_dir/bin/rbenv --version | sed -E 's/^.+-([[:digit:]]{1,}).+$/\1/g')
|
|
|
|
if [ $user_commits -ge $supports_fish_commits ]
|
|
|
|
set supports_fish true
|
|
|
|
end
|
|
|
|
else
|
|
|
|
set -l higher_version (echo -e "$supports_fish_version\n$user_version" | \
|
|
|
|
sort --field-separator . \
|
|
|
|
--key 1,1 --numeric-sort --reverse \
|
|
|
|
--key 2,2 --numeric-sort --reverse \
|
|
|
|
--key 3,3 --numeric-sort --reverse | \
|
|
|
|
head -n 1)
|
|
|
|
if [ $user_version = $higher_version ]
|
|
|
|
set supports_fish true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
_prepend_path $rbenv_dir/bin
|
|
|
|
if [ $supports_fish ]
|
|
|
|
status --is-interactive; and source (eval $rbenv_dir/bin/rbenv init - | psub)
|
2013-11-03 17:18:10 +00:00
|
|
|
else
|
2014-12-07 05:13:45 +00:00
|
|
|
_prepend_path $rbenv_dir/shims
|
2013-03-04 03:21:43 +00:00
|
|
|
end
|