Automatically posting JIRA defects links to PresentlyApp.com

On our team we thought it’d be useful to auto-post Blocker defects from Jira to our presently stream. The gems httparty and jira4r made it easy.

Here are the steps:

1. Install JIRA, create a user

2. Create a Filter for the defects you want to auto-post, get the ID for that filter from the URL when viewing it. ‘jiradmin’ in this example

3. Create a user on presently to post from. ‘jira’ in this example

4. Create a cron or windows tasks to run the following ruby code once per hour:

jira_presently.rb

#!/usr/bin/env ruby
require ‘rubygems’
require ‘httparty’
require ‘rexml/document’
require ‘jira4r/jira4r’

# make a HTTParty object for integrating with presentlyapp.com
class Presently
include HTTParty
# Presently api url
base_uri ‘https://[EXAMPLE].presentlyapp.com/api/twitter’
#jira presently user credentials
basic_auth ‘jira’, ‘[PRESENTLY PASSWORD]‘
default_params :output => ‘json’
format :json
end

# link to your JIRA server and credentials
JIRA_URL = “[http://jira.url.com/]“
jira = Jira::JiraTool.new(2, JIRA_URL)
jira.login(“jiraadmin”, “[JIRA PASSWORD]“)

#  Look at key in JIRA filter URL to get ID for the filter
issues = jira.getIssuesFromFilter(10112)

issues.each do |issue|
# post for the last 1 hour
if Time.parse(issue.created.to_s) > (Time.now – 60*60)
issue_post = “Blocker: ” + issue.key + ” – ” + issue.summary[0..75] + ” #{JIRA_URL}/browse/” + issue.key
puts Presently.post(‘/statuses/update.json’, :query => {:status => issue_post}).inspect
else
puts issue.key + ” is older than 1 hour”
end
end

Trackbacks/Pingbacks

  1. links for 2008-12-31 « Brent Sordyl’s Blog - December 31, 2008

    [...] Automatically posting JIRA defects links to PresentlyApp.com « Brent Sordyl’s Blog On our team we thought it’d be useful to auto-post Blocker defects from Jira to our present.ly stream. The gems httparty and jira4r made it easy. (tags: collaboration jira HTTParty present.ly) [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.