Hi,
I'm really new to TextMate, having recently converted to a bit of Ruby development on the Mac. I'm interested in writing a bundle or some commands to help me use a tool called Hackystat. You can check out a few things about it here:
http://hackystat.ics.hawaii.edu/hackystat/docbook/ch05.html
Basically, it's a metrics collection server. It lets you install small sensors to collect software metrics, like how long you worked on a particular file. Since it's automatic it stays out of your way, it's consistent, and it's reliable. Each user controls their own metrics data.
I want to write a sensor to collect these metrics from TextMate. The basics would be: 1) log when a new file is opened, 2) log when a file is closed, and 3) every so often (30 seconds) log which file is in the active window. Pretty simple.
I'd like to start a small command-line program from a TM command, but I'd like to keep it open until TM is closed and send info to it periodically throughout the TM session.
I've seen several items about launching command-line programs from TM, but can I keep one open in the background? Does TM block until the script finishes or can my Ruby script start another process and then return and get back to that process later?
Can I intercept the File | Open actions and then record my metrics? I haven't seen how to do this in other posts. There's a growing list of tools that support Hackystat, including Emacs, Vim, Eclipse, and VisualStudio. I'd love to add TextMate to that list.
http://hackystat.ics.hawaii.edu/hackystat/docbook/apa.html
Plese let me know if any of this is possible and where I can dig up some documentation on it.
Thanks!
Tim
On 04/08/2005, at 8.47, Tim Shadel wrote:
[...] I want to write a sensor to collect these metrics from TextMate. The basics would be: 1) log when a new file is opened, 2) log when a file is closed, and 3) every so often (30 seconds) log which file is in the active window. Pretty simple.
Currently there are no hooks for these things, but it could happen through a plugin. Something which is soon to debut -- are you familiar with writing Objective-C? if so, I'd suggest subscribing to textmate-plugins [1] (and there should soon be the required notifications by means of a plugin).
[...] I've seen several items about launching command-line programs from TM, but can I keep one open in the background?
If your command launches a new process, that process will continue to run after control is returned to TextMate.
If you want to provide an interface to control the process then you can make use of the ability for JavaScript in the HTML output to control shell commands. I added an example command to the experimental bundle [2] which opens a window with the time (updated each second) that you can start/stop.
Can I intercept the File | Open actions and then record my metrics? I haven't seen how to do this in other posts.
No, that's currently not possible, but as implied above, I don't mind providing the necessary notifications (as NSNotification's that an Objective-C plugin can observe).
[1] http://lists.macromates.com/mailman/listinfo/textmate-plugins [2] http://anon:anon@macromates.com/svn/Bundles/trunk/Bundles/ Experimental.tmbundle/
On 8/5/05, Allan Odgaard allan@macromates.com wrote:
[...]if so, I'd suggest subscribing to textmate-plugins [1]
Excellent. Subscribed.
I added an example command to the experimental bundle [2] which opens a window with the time (updated each second) that you can start/stop.
Thanks. I'll look into that.
[...] I don't mind providing the necessary notifications (as NSNotification's that an Objective-C plugin can observe).
Perfect. I'm looking forward to it.
Thanks!
Tim