Browse code

Gem List Helper

Add helper function to list gems in a pretty way (only with rvm, for now). Add
missng EOF newline and a todo to the ruby plugin.

Andrew Hodges authored on 28/05/2011 at 14:50:06
Showing 2 changed files
... ...
@@ -1,4 +1,6 @@
1
+# TODO: Make this compatible with rvm.
2
+#       Run sudo gem on the system ruby, not the active ruby.
1 3
 alias sgem='sudo gem'
2 4
 
3 5
 # Find ruby file
4
-alias rfind='find . -name *.rb | xargs grep -n'
5 6
\ No newline at end of file
7
+alias rfind='find . -name *.rb | xargs grep -n'
... ...
@@ -38,3 +38,15 @@ function rvm-update {
38 38
 function rvm-link-completion {
39 39
 	ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official"
40 40
 }
41
+
42
+# TODO: Make this usable w/o rvm.
43
+function gems {
44
+	local current_ruby=`rvm-prompt i v p`
45
+	local current_gemset=`rvm-prompt g`
46
+
47
+	gem list $@ | sed \
48
+		-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
49
+		-Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
50
+		-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
51
+		-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
52
+}