Browse code

detect rvm or rbenv and show ruby version

Max Gonzih authored on 13/08/2011 at 10:29:13
Showing 1 changed files
... ...
@@ -1,4 +1,4 @@
1
-# ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png
1
+# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
2 2
 # Based on bira theme
3 3
 
4 4
 # load some modules
... ...
@@ -35,9 +35,17 @@ local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
35 35
 
36 36
 local user_host='${PR_USER}${PR_CYAN}@${PR_HOST}'
37 37
 local current_dir='%{$PR_BOLD$PR_BLUE%}%~%{$PR_NO_COLOR%}'
38
-local rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}'
38
+local rvm_ruby=''
39
+if which rvm-prompt &> /dev/null; then
40
+  rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}'
41
+else
42
+  if which rbenv &> /dev/null; then
43
+    rvm_ruby='%{$PR_RED%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$PR_NO_COLOR%}'
44
+  fi
45
+fi
39 46
 local git_branch='$(git_prompt_info)%{$PR_NO_COLOR%}'
40 47
 
48
+#PROMPT="${user_host} ${current_dir} ${rvm_ruby} ${git_branch}$PR_PROMPT "
41 49
 PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
42 50
 ╰─$PR_PROMPT "
43 51
 RPS1="${return_code}"