Create a gist now

Instantly share code, notes, and snippets.

# Requires the redmine_client gem
#!/usr/bin/env ruby
require 'rubygems'
require 'redmine_client'
NORMAL = "\e[00;00m"
NORMAL_BOLD = "\e[00;01m"
YELLOW = "\e[00;33m"
BORING_CYAN = "\e[00;36m"
BLUE = "\e[00;34m"
CYAN = "\e[01;36m"
RED = "\e[00;31m"
GREEN = "\e[00;32m"
BOLD_GREEN = "\e[01;32m"
DEEP_BLUE = "\e[01;34m"
SEPARATOR = "#{RED}===#{NORMAL}"
RedmineClient::Base.site = "http://project.puppetlabs.com"
RedmineClient::Issue.site = "http://projects.puppetlabs.com"
# The request fails with a 500 error if User-Agent isn't set
RedmineClient::Issue.headers["User-Agent"] = "Anything"
issue = RedmineClient::Issue.find(ARGV[0])
puts "#{NORMAL_BOLD}#{issue.subject} #{BORING_CYAN}[#{issue.status.name}]#{NORMAL}"
puts
puts "#{YELLOW}#{issue.author.name}#{NORMAL}\n"
# Boldify code blocks
puts issue.description.gsub("<pre>",NORMAL_BOLD).gsub("</pre>",NORMAL)
issue.journals.journal.each do |journal|
next unless journal.notes
puts
puts "#{YELLOW}#{journal.user.name}#{NORMAL}\n"
puts journal.notes
end rescue nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment