Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Niklas Cathor's Ruby Trac XML-RPC Wrapper
Branch: master

Merge pull request #3 from pdecourcel/master

Query arg "max=0" is missing
latest commit 6a71856fae
@csexton authored
Failed to load latest commit information.
bin Using milestone and keywords in new ticket
.gitignore restructured and gemified
LICENCE Initial import from the tar file on Trac-Hacks
README.rdoc Merging in jesperronn's documentation.
Rakefile better rdoc
VERSION Version bump to 1.2.3


trac4r: Ruby wrapper for the Trac XML-RPC API


Niklas Cathor


David Copeland


See LICENSE in source distribution

For more information on the Trac XML-RPC see the plugin’s page on

Thanks to the original author, Niklas Cathor, who has done most of the work.

Note that I (David Copeland) will probably not be making more changes to this, as my main reason for picking this up was that I am using Trac where I work. We are moving away from Trac, so I have less need to do anything with this library. If someone is interested in claiming ownership, specifically owning the gem on Gemcutter, just let me know and I'll hand it over.


# Only if you haven't set up gemcutter yet
sudo gem install gemcutter
sudo gem tumble

# Once Gemcutter is setup
sudo gem install trac4r


This wraps the Trac XML-RPC plugin.

require 'rubygems'
require 'trac4r'

# Note that you need to point to the XMLRPC root and not the root of the trac web interface
trac ="","username","password") # get all tickets 2334 # Get ticket #2334

Receive one single ticket

ticket = 9
ticket.summary #=> 'foo'
ticket.description #=> 'bar'

Scope the ticket :include_closed => false

Create a new ticket "summary", "description", :type => 'defect', :version => '1.0', :milestone => 'bug free' #=> 10

summary and description are required, the rest is optional. It can be one of the following: :severity, :milestone, :status, :type, :priority, :version, :reporter, :owner, :cc, :keywords


Trac's backbone is tickets. The Tickets class contains many useful methods, but can also run arbitrary queries against Trac using a more Rubyesque syntax:

# Gets all tickets in the "Web" component with a status of either "assigned"
# "accepted", or "new"
available_web_tickets = => 'Web', :status => [:assigned,:accepted,:new])

# Ticktes that are not closed
unclosed_tickets = => "!closed")

# This is a bit wierd, the "!" in the first element means "none of these values"
not_closed_nor_testing = => ["!closed","test"])


More Info

Something went wrong with that request. Please try again.