Created
February 15, 2014 17:17
-
-
Save woodybrood/9022181 to your computer and use it in GitHub Desktop.
My simple JIRA reporting tool. It outputs HTML to go into Evernote.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative 'jira_lister.rb' | |
require 'yaml' | |
config_file = YAML.load_file(File.dirname(__FILE__) + "/jira_config.yaml") | |
jira = JiraLister.new(config_file) | |
# Show all projects | |
puts jira.generate_jira_list('assignee="tester" and status in ("Needs QA Review")', "JIRAs to DO") | |
puts jira.generate_jira_list('filter = "Tested Yesterday" AND ("Primary Assignee" = tester OR "Primary Tester" = tester)', "JIRAs Tested Yesterday") | |
puts jira.generate_jira_list('filter = "Done Yesterday" AND ("Primary Assignee" = tester OR "Primary Tester" = dan) AND assignee was tester', "JIRAs Done Yesterday") | |
puts jira.generate_jira_list('filter = "Created Yesterday" AND reporter = tester', "JIRAs Created Yesterday") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
username: user | |
password: 1234 | |
site: https://jira.bogussite.com/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'pp' | |
require 'jira' | |
require 'json' | |
class JiraLister | |
def initialize(config_file) | |
@options = { | |
:username => config_file['username'], | |
:password => config_file['password'], | |
:site => config_file['site'], | |
:context_path => '/', | |
:auth_type => :basic | |
} | |
@client = JIRA::Client.new(@options) | |
end | |
def generate_jira_list(issue_list_name, title) | |
issue_list = get_issue_list(issue_list_name) | |
html = "<b>#{title}</b><br/>" | |
html += "<ul>" | |
if issue_list.size == 0 | |
html += "<li></li>" | |
end | |
issue_list.each do |subtask| | |
summary = subtask.fields['summary'] | |
status = subtask.fields['status']['name'] | |
key = subtask.key | |
html += "<li> <en-todo/> #{key} :: #{subtask.fields['priority']['name']} :: #{subtask.fields['issuetype']['name']} :: <a href=""#{@options[:site]}}/browse/#{key}""> <b>#{summary}</b> </a> :: #{status}</li> " | |
end | |
html += "</ul>" | |
return html | |
end | |
def get_issue_count(filter) | |
size = get_issue_list(filter).size | |
if size.nil? | |
return 0 | |
else | |
return size | |
end | |
end | |
def generate_jira_table(issue_list_name, title) | |
issue_list = get_issue_list(issue_list_name) | |
html = "<b>#{title}</b><br/>" | |
html += "<table>" | |
if issue_list.size == 0 | |
html += "No Issues<br/>" | |
end | |
issue_list.each do |subtask| | |
summary = subtask.fields['summary'] | |
status = subtask.fields['status']['name'] | |
key = subtask.key | |
html += "<tr> <td> #{key} </td><td> <b>#{summary}</b> </td><td>#{@options[:site]}}/browse/#{key}</td><td>#{status}</td></tr> " | |
end | |
html += "</table>" | |
return html | |
end | |
def get_jira_list_summary(issue_list_name) | |
issue_list = get_issue_list(issue_list_name) | |
message = "" | |
issue_list.each do |subtask| | |
summary = subtask.fields['summary'] | |
priority = subtask.fields['priority']['name'] | |
key = subtask.key | |
message += "#{key} :: #{priority} :: #{summary} \n" | |
end | |
return message | |
end | |
def get_issue_list(issue_list_name) | |
@client.Issue.jql(issue_list_name) | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment