Turn a Redmine Issue into an OmniFocus Inbox Item

February 14th, 2013  |  Published in ruby

I dropped this into an Automator Run Shell Script item and turned it into a service. It acts on your selected text and assumes you’ve either selected a valid Redmine issue URL (e.g. “http://projects.puppetlabs.com/12345”) or a valid Redmine issue number (e.g. “12345”). I tied it to the keystroke C-S-r, to drop the issue description and URL into the OmniFocus inbox.

The sad part of this story is that rb-appscript isn’t under active development, so stuff like this won’t last much longer. Then it’s on to something Apple-sanctioned, like MacRuby or RubyCocoa (or falling back to the dark times of do shell script).

require "rubygems"
require "appscript"
require "redmine_client"
include Appscript

RedmineClient::Base.configure do self.site = 'http://projects.puppetlabs.com' self.user = 'USER' self.password = 'PASS' end

ARGV.each do |f| issue_select = f

if issue_select.match(/^http/) issue_id = issue_select.match(/\d{1,}$/)[0] else issue_id = issue_select end

issue = RedmineClient::Issue.find(issue_id) issue_url = "http://projects.puppetlabs.com/issues/#{issue_id}"

of = app("Omnifocus").documents[0]

of.make(:new => :inbox_task, :with_properties => { :name => "(##{issue_id}) #{issue.subject}", :note => "#{issue_url}\n\n#{issue.description}", }) end


Leave a Response

© Michael Hall, licensed under a Creative Commons Attribution-ShareAlike 3.0 United States license.