I used TaskPaper when it first came out, and loved it, but quit using it after a while because I used some non-Mac computers, and wanted a web component to get to it anywhere. I missed it, though, and this week, moved back after I wrote a script to sync my TaskPaper files to Tasko. It's not really abstracted, and a lot of this is for my system specifically, but I thought I'd share.
First, I have a Tasks/ directory under my home directory. You can use whatever directory you want, but it's assumed you have a directory with one or more .taskpaper files in it.
Here is a Ruby script to sync that directory to Tasko: http://pastie.org/223870. This is really suboptimal code, and I am going to refactor it, but it works well. Here's its logic:
This ends up working in almost all cases. If you add a file online, TaskoSyncer will note that you didn't have it locally, so it will know to grab it. Likewise, if there's a file online that isn't local, but it used to be, TaskoSyncer will know to delete the online one.
So, this is pretty good on its own, but wait! launchd makes this way better. Here's a .plist file I wrote and saved at /Library/LaunchDaemons/org.cnixon.taskosync:
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE plist PUBLIC “-//Apple Computer//DTD PLIST 1.0//EN”
“http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
<plist version=”1.0″>
<dict>
<key>Label</key>
<string>org.cnixon.taskosync</string>
<key>ProgramArguments</key>
<array>
<string>/Users/cnixon/bin/taskosync</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WatchPaths</key>
<array>
<string>/Users/cnixon/Tasks/</string>
</array>
</dict>
</plist>
Whenever any contents in my Tasks/ directory change, it syncs. Since it ignores non-.taskpaper files, I can force sync by touching an empty file in there, although it's just as easy to run taskosync from the command line.
jesse - June 30, 2008 7:39 AM
Thanks very much for sharing this! If you come up with further enhancements please post them if you've got the time.
reply | edit
Ramanan Sivaranjan - July 2, 2008 10:28 PM
I think the following two lines are wrong:
@dirand@summary_fileare instance variables, and they will be null when theinitializemethod is called. I get what you are trying to do, but you need to check ifdirandsummary_fileare nill. So you probably need to be doing this:Besides that, this script is awesome. I love it.
reply | edit
Clinton R. Nixon - July 3, 2008 5:56 AM
Ramanan,
Thanks! I didn't notice that because I wasn't actually passing those in: I added them at the last minute to make it easier for others to use.
reply | edit
Nathanaël Lécaudé - July 30, 2008 6:06 PM
Just to be sure, In order to pull down info from Tasko, you still need to run the script manually ? (or program it via launchd to run at a specified interval, though it could be messy) ?
Thanks,
Nat
reply | edit
Topic's comments