polishing ruby by ryan davis

omnifocus gem

Published 2012-05-25 @ 12:00

Tagged productivity, omnifocus

This is part of the Productivity Pr0n series.

I wrote a gem with the oh-so-original name of ‘omnifocus’ to help me interact with omnifocus in more sophisticated ways than omnifocus provides up front. Specifically, I wanted to be able to interact with bug trackers, view my tasks in different ways, be able to script up new tasks, and to be able to intelligently schedule my project reviews and my project oriented tasks.

BTS Syncing

While it does a lot more now, my gem was originally written to just sync tasks from various bug tracking systems (BTS) into omnifocus. This provides me a single point of entry on anything I might need to work on. The syncing is one-way only, partially because it was easier to do, but also because you should communicate why an issue is being closed.

% of sync
scanning rubyforge
scanning github
scanning redmine
removing GH-vlad#20
creating GH-vlad#22


By itself, the omnifocus gem doesn’t sync with anything. Instead, it has a flexible plugin system making it easy to support whatever BTS you need. There are already many gems for various BTSes. Currently there are gems for github, bugzilla, pivotaltracker, redmine, rt, and rubyforge (all named omnifocus-). Each one is configured differently but it usually just a simple matter of running `of sync` and then filling out a YAML file with server credentials.

% gem install omnifocus omnifocus-github
% git config --global --add github.user zenspider
% git config --global --add github.password yeahright
% of sync

Creating Tasks & Projects

of new

You can easily create new projects and tasks with the omnifocus gem:

% of new
usage: of new project_name title        - create a project task
       of new nil          title        - create an inbox task
       of new project      project_name - create a new project

project_names = autotest-rails, blog, cast, cola, condo, cooking, ...

This makes it dead simple to create a ton of tasks:

for f in lib/**/*.rb; do
  of new myproject Code review $f

Viewing Tasks & Time

The omnifocus gem also provides several views of your tasks:

of projects

The projects subcommand gives you a simple aggregated view of your active projects and the number of unscheduled tasks you have in each one:

% of projects
  231: 100%: Total

   32:  13%: rubygems (1w)
   20:   8%: improvement (5w)
   19:   8%: image_science (3w)
   19:   8%: blog (2w)
   17:   7%: vlad (3w)

of schedule

The schedule subcommand shows you what you have scheduled for a given project or context:

% of schedule Releasing
          date\ tot 1w 2w 3w 5w 7w 
2012-05-22 Tue:   2  0  0  0  0  2 
2012-05-23 Wed:   1  1  0  0  0  0 
2012-05-24 Thu:   8  2  2  2  2  0 
2012-05-25 Fri:   6  2  2  2  0  0 
         total:  70  9 18 20 12 11 

2012-05-22 Tue
  7w: Release heckle
  7w: Triage heckle tickets
2012-05-23 Wed
  1w: 1.03 Release minitest
2012-05-24 Thu
  1w: 1.04 Release zentest
  1w: 1.04 Triage zentest tickets
2012-05-25 Fri
  1w: 1.05 Release isolate
  1w: 1.05 Triage isolate tickets

of time

The time subcommand simply shows you how much scheduled time you have:

% of time
all tasks = 26830 minutes
          = 447.17 hours

of review

The review subcommand shows you your project’s review schedules:

% of review
          date\ tot 1w 2w 3w 5w 7w 
2012-05-25 Fri:  27  8  6  5  6  2 
2012-06-01 Fri:  20  0  7  5  6  2 
2012-06-08 Fri:  13  0  0  5  6  2 
2012-06-15 Fri:   5  0  0  0  3  2 
2012-06-22 Fri:   8  0  0  0  6  2 
2012-07-06 Fri:   2  0  0  0  0  2 
         total:  75  8 13 15 27 12 

2012-05-25 Fri
  1w: Miscellaneous, finances, hoe, isolate, minitest, ruby-trunk, rubygems, zentest
  2w: flay, flog, graph, rubyinline, sexp_processor, zenweb
  3w: omnifocus-github, omnifocus-redmine, railsbridge, rake-remote_task, vlad
  5w: Daily Review, Miscellaneous, improvement, metaruby, png, tedium
  7w: heckle, ruby-ometa
2012-06-01 Fri
  2w: blog, emacs, improvement, omnifocus, ruby 1.9, ruby2ruby, ruby_parser
  3w: image_science, ruby2c, sysadmin, zendebug, zenprofile
  5w: Monthly Review, Weekly Review, racc, rdoc_osx_dictionary, seattlerb conf, vacation
  7w: event_hook, parsetree

of wtf

The ‘wtf’, or ‘where to focus’ :) subcommand shows you a top-10 aggregate view of your tasks by project/context, context, and project:

% of wtf
  38 blog: Writing          77 3 New Feature         32 rubygems             
  19 rubygems: 3 New Featu  51 Writing               29 improvement          
  11 improvement: Research  41 2 Bug                 19 blog                 
  11 rubygems: 2 Bug        30 Researching           19 image_science        
   9 sysadmin: Maintaining  16 Shopping              17 sysadmin             
   8 cooking: Home          14 Aaron                 17 vlad                 
   8 image_science: 2 Bug   12 Home                  15 cooking              
   8 improvement: Reading   11 Reading               11 condo                
   8 zenweb: 3 New Feature  10 Maintaining            9 Worster Ideas Everer 
   7 Worster Ideas Everer:  10 Organizing             9 zentest              


of reschedule

The reschedule subcommand is freakin’ awesome but it is also a bit scary/powerful. In one fell swoop it synchronizes project oriented task repeat intervals to the project review intervals, fixes any project oriented task numeric prefixes to match the project review interval, and it reschedules all project oriented tasks as needed to match an optimally distributed calendar. In other words, it pretty much handles making sure all your ducks are in a row.

of fix_review_dates

The fix_review_dates subcommand reschedules review dates back to Friday in case you ever review a project early or late. This command will be folded into reschedule at some point.