From 8a887c505282b771193ac3ee6df05a1fa3f8426a Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Tue, 31 Dec 2013 02:11:02 +0100 Subject: [PATCH] Joins ruby prompt files and adds ruby_prompt_info. --- lib/chruby.zsh | 4 ---- lib/rbenv.zsh | 4 ---- lib/ruby_prompts.zsh | 22 ++++++++++++++++++++++ lib/rvm.zsh | 8 -------- 4 files changed, 22 insertions(+), 16 deletions(-) delete mode 100644 lib/chruby.zsh delete mode 100644 lib/rbenv.zsh create mode 100644 lib/ruby_prompts.zsh delete mode 100644 lib/rvm.zsh diff --git a/lib/chruby.zsh b/lib/chruby.zsh deleted file mode 100644 index b78d04f86..000000000 --- a/lib/chruby.zsh +++ /dev/null @@ -1,4 +0,0 @@ -# using the chruby plugin will override this with a real implementation -function chruby_prompt_info() { - return 1 -} diff --git a/lib/rbenv.zsh b/lib/rbenv.zsh deleted file mode 100644 index f58074b83..000000000 --- a/lib/rbenv.zsh +++ /dev/null @@ -1,4 +0,0 @@ -# using the rbenv plugin will override this with a real implementation -function rbenv_prompt_info() { - return 1 -} diff --git a/lib/ruby_prompts.zsh b/lib/ruby_prompts.zsh new file mode 100644 index 000000000..287b3ff0a --- /dev/null +++ b/lib/ruby_prompts.zsh @@ -0,0 +1,22 @@ +# get the name of the rvm ruby version +function rvm_prompt_info() { + [ -f $HOME/.rvm/bin/rvm-prompt ] || return 1 + local rvm_prompt + rvm_prompt=$(eval "$HOME/.rvm/bin/rvm-prompt $ZSH_THEME_RVM_PROMPT_OPTIONS" 2>/dev/null) + [[ "${rvm_prompt}x" == "x" ]] && return 1 + echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}" +} + +# using the rbenv plugin will override this with a real implementation +function rbenv_prompt_info() { + return 1 +} + +# using the chruby plugin will override this with a real implementation +function chruby_prompt_info() { + return 1 +} + +function ruby_prompt_info() { + echo $(rvm_prompt_info || rbenv_prompt_info || chruby_prompt_info) +} diff --git a/lib/rvm.zsh b/lib/rvm.zsh deleted file mode 100644 index 04d116397..000000000 --- a/lib/rvm.zsh +++ /dev/null @@ -1,8 +0,0 @@ -# get the name of the ruby version -function rvm_prompt_info() { - [ -f $HOME/.rvm/bin/rvm-prompt ] || return 1 - local rvm_prompt - rvm_prompt=$(eval "$HOME/.rvm/bin/rvm-prompt $ZSH_THEME_RVM_PROMPT_OPTIONS" 2>/dev/null) - [[ "${rvm_prompt}x" == "x" ]] && return 1 - echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}" -}