Permalink
Browse files

Fixed PATH, added commands for viewing gem documentation or source (w…

…ith tab completion)
  • Loading branch information...
1 parent dca54c1 commit 107219f867721067adb8ba47ef596c9c7805661b Inge Jørgensen committed Apr 17, 2008
Showing with 35 additions and 1 deletion.
  1. +10 −0 bin/edit_gem
  2. +12 −0 bin/gem_doc
  3. +3 −0 completions/edit_gem.fish
  4. +3 −0 completions/gem_doc.fish
  5. +7 −1 config.fish
View
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+require 'rubygems'
+
+if ARGV.first == '-l' || ARGV.first == '--list'
+ puts Gem.cache.map{ |s| s[1].name }.uniq.sort.join( "\n" )
+else
+ gem_name = ARGV.first
+ gem_info = Gem.cache.search( gem_name ).first
+ system "mate #{gem_info.full_gem_path}"
+end
View
@@ -0,0 +1,12 @@
+#!/usr/bin/env ruby
+require 'rubygems'
+
+
+if ARGV.first == '-l' || ARGV.first == '--list'
+ puts Gem.cache.map{ |s| s[1].name }.uniq.sort.join( "\n" )
+else
+ gem_name = ARGV.first
+ gem_info = Gem.cache.search( gem_name ).first
+ doc_file = File.join( gem_info.full_gem_path.gsub(/1\.8\/gems/, "1.8/doc"), 'rdoc/index.html' )
+ system "open #{doc_file}"
+end
@@ -0,0 +1,3 @@
+complete -x -c edit_gem -a '(edit_gem --list)' --description 'Ruby Gem'
+complete -c edit_gem -s l -l list --description "List installed gems"
+
View
@@ -0,0 +1,3 @@
+complete -x -c gem_doc -a '(gem_doc --list)' --description 'Ruby Gem'
+complete -c gem_doc -s l -l list --description "List installed gems"
+
View
@@ -1,4 +1,10 @@
-set PATH /opt/local/bin ~/.config/fish/bin ~/bin $PATH
+set PATH /opt/local/bin ~/bin $PATH
+
+# Adding ~/.config/fish/bin to the path breaks for some reason unless the dir exists, let's test for that.
+if test -d ~/.config/fish/bin
+ set PATH ~/.config/fish/bin $PATH
+end
+
set EDITOR "mate"
set fish_greeting ""

0 comments on commit 107219f

Please sign in to comment.