2012-09-07 03:06:50 +00:00
|
|
|
#
|
2012-09-07 03:17:38 +00:00
|
|
|
# Exposes information about the Ruby environment via the $ruby_info associative
|
|
|
|
# array.
|
2012-09-07 03:06:50 +00:00
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
|
|
#
|
|
|
|
|
|
|
|
local version
|
|
|
|
local version_format
|
|
|
|
local version_formatted
|
|
|
|
|
|
|
|
# Clean up previous $ruby_info.
|
|
|
|
unset ruby_info
|
|
|
|
typeset -gA ruby_info
|
|
|
|
|
|
|
|
if (( $+commands[rvm-prompt] )); then
|
|
|
|
version="$(rvm-prompt)"
|
|
|
|
elif (( $+commands[rbenv] )); then
|
|
|
|
version="$(rbenv version-name)"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Format version.
|
|
|
|
if [[ -n "$version" ]]; then
|
2012-10-02 02:00:12 +00:00
|
|
|
zstyle -s ':prezto:module:ruby:info:version' format 'version_format'
|
2012-09-07 03:06:50 +00:00
|
|
|
zformat -f version_formatted "$version_format" "v:$version"
|
|
|
|
ruby_info[version]="$version_formatted"
|
|
|
|
fi
|
|
|
|
|