[TxMt] [TextMate] Help With Ruby Command
Kjell Olsen
kjell at station11.net
Tue Oct 26 04:55:02 UTC 2004
I love the idea of Daniel Von Fanges TextMate Log Script[1], but my
unfamiliarity with both ruby and textmate is giving me a headache. I
hope I can use you guys as a sounding board and this doesn't bug you
too much.
[1]: http://www.braino.org/blog/archives/001440.php
I can't make the date function work within the command - If I execute
my script outside of textmate it works beautifully, but from within
textmate I get:
<code>
date: illegal time format
usage: date [-nu] [-r seconds] [+format]
date [[[[[cc]yy]mm]dd]hh]mm[.ss]
</code>
When I run the same script with the textmate variables replaced by
normal strings I get:
<code>* [23:19:54 ] @test -> just a test action</code>
Do the ticks ` in the date function mean that I'm using bash's date
program? The error thrown in the command matches the error from the
command line, but why doesn't it happen when the script is executed by
ruby?
Why won't this work? All the help I can get would be very much
apreciated. I'm using v1.02b1, and here's what the command looks like
in it's entirety:
<code>
/usr/bin/env ruby <<END
task_text = "$TM_CURRENT_LINE"
task_text.gsub!("* ","* [#{`date \"+%H:%M:%S\"`}] ")
task_text.gsub!("\n","")
from = "$TM_CURRENT_FILE"
File.open("/Users/kjell/Documents/planner/complete",'a'){|archive_file|
archive_file.puts task_text
#archive_file.puts " in #{from} #{`date \"+%H:%M %Y%m%d %a\"`}"
archive_file.puts
}
END
</code>
More information about the textmate
mailing list