[SVN] Ruby; command to show rdoc for current ruby source

David Smiley dsmiley at mitre.org
Tue Mar 7 21:13:59 UTC 2006


Today I created a new command for the Ruby bundle to display the rdoc  
output of the current ruby source file.  I started by copying the  
"Run Script" command and tweaked from there.  Here is what I have:

# Save file, use tmp-file if there's no filepath.
[[ -z "$TM_FILEPATH" ]] && TM_TMPFILE=$(mktemp -t rubymate)
: "${TM_FILEPATH:=$TM_TMPFILE}"; cat >"$TM_FILEPATH"

#get output directory for rdoc
TM_TMPOUTDIR=/tmp/rdoc
rm -Rf "$TM_TMPOUTDIR" #ensure doesn't exist

rdoc -q -a -o "$TM_TMPOUTDIR" "$TM_FILEPATH"
open "$TM_TMPOUTDIR/index.html"


I couldn't use HTML Output... I had to discard it and open the output  
in a web browser.  The reason is that the HTML output doesn't handle  
frames.  I also couldn't use mktemp to generate the rdoc output  
directory because rdoc wants it to not exist (rdoc complains that it  
doesn't "look like" an rdoc directory... hmmm...), yet mktemp creates  
it.

Comments?

~ David Smiley



More information about the textmate-dev mailing list