TextMate command: Invoke selection under OpenACS

TextMate truly rocks. Just wrote another neat command in no time: Invoke in OpenACS.

One really great Rails feature that OpenACS lacks is the ability to run the interactive irb shell right inside the Rails environment, with all your models and helpers available, so you can poke around and try things out easily.

Well, now OpenACS has something that comes fairly close:

echo "proc textmate {} {" > $OACS_PAGEROOT/textmate.tcl
echo "$TM_SELECTED_TEXT" >> $OACS_PAGEROOT/textmate.tcl
echo "}" >> $OACS_PAGEROOT/textmate.tcl
echo "ns_return 200 text/html [textmate]" >> $OACS_PAGEROOT/textmate.tcl
curl -s $OACS_URL/textmate


UPDATE: Improved error-handling:



echo "proc textmate {} { " > $OACS_PAGEROOT/textmate.tcl
echo "$TM_SELECTED_TEXT" >> $OACS_PAGEROOT/textmate.tcl
echo "}" >> $OACS_PAGEROOT/textmate.tcl
echo "catch { set result [textmate] } result" >> $OACS_PAGEROOT/textmate.tcl
echo "ns_return 200 text/html \$result" >> $OACS_PAGEROOT/textmate.tcl
curl -s $OACS_URL/textmate

0 comments

There are no comments yet. Be the first one to leave a comment!

Leave a comment