diff --git a/campfirelistener/campfirelistener.py b/campfirelistener/campfirelistener.py
index 9a1c304..44b6b1e 100644
--- a/campfirelistener/campfirelistener.py
+++ b/campfirelistener/campfirelistener.py
@@ -2,15 +2,23 @@
import pinder
from trac.core import *
from trac.ticket.api import ITicketChangeListener
+from trac.config import Option, IntOption, ListOption, BoolOption
class CampfireListener(Component):
implements(ITicketChangeListener)
+
+ prefix = Option('campfire', 'prefix', '')
+ projectPath = Option('campfire', 'path', '')
+ tracfqdn = Option('campfire', 'trachost', '')
+ subdomain = Option('campfire', 'subdomain', '')
+ apiToken = Option('campfire', 'apitoken', '')
+ roomId = Option('campfire', 'roomid', '')
def _sendText(self, ticketid, text):
try:
- c = pinder.Campfire('SUBDOMAIN', 'API TOKEN')
- room = c.room('ROOM ID')
- room.speak("Trac: ticket #%i (http://trac.YOURDOMAIN.com/projects/PROJECT/ticket/%i) %s" % (ticketid, ticketid, text))
+ c = pinder.Campfire(subdomain, apiToken)
+ room = c.room(roomId)
+ room.speak("%s: ticket #%i (http://%s%s/ticket/%i) %s" % (prefix, tracfqdn, projectPath, ticketid, text))
except:
print "Unexpected error:", sys.exc_info()[0]
diff --git a/readme.textile b/readme.textile
index f382535..b4115d2 100644
--- a/readme.textile
+++ b/readme.textile
@@ -1,3 +1,4 @@
+h1 Introduction
If you are using "trac":http://trac.edgewall.org/ and you want to display ticket changes on "Campfire":http://www.campfirenow.com/ here is a handy hack plugin.
Here is a juicy screenshot demonstrating how it looks like.
@@ -6,6 +7,7 @@ Here is a juicy screenshot demonstrating how it looks like.
If you'd rather use IRC instead of Campfire you might want to try out the handy "irccat":http://github.com/RJ/irccat/tree/master which is "notoriously used by the Last.fm development teams":http://www.metabrew.com/article/how-we-use-irc-at-lastfm/ instead. This Campfire plugin is actually only a slight change from the irccat trac plugin.
+h1 Installation
So here’s the gist. You will need to install "Pinder":http://dev.oluyede.org/pinder/doc.html, a Campfire listener written in Python. It should be as easy as:
$ easy_install pinder@@ -14,6 +16,24 @@ Then download or
git clone
the "Campfire trac listener plugin on gi
You will need to have "setuptools":http://peak.telecommunity.com/DevCenter/setuptools installed. (To install setuptools, download the bootstrap module "ez_setup.py":http://peak.telecommunity.com/dist/ez_setup.py and execute: $ python ez_setup.py
)
-Now edit campfirelistener/campfirelistener.py
to your taste. Especially, you'll need to set up the Campfire subdomain (something like subdomain.campfirenow.com
), the Campfire room, and the Campfire username and password (as you can see my Campfire wonderbot is named Hector). When it's all done run python setup.py bdist_egg
to build the egg.
+Next, go to the campfire-trac-listener
directory that you've just created with your git clone
and run python ./setup.py install
.
+
+If this installs successfully, you are ready to begin configuration.
+
+h1 Configuration
+Put the following into your trac.ini
file:
+
+[campfire]
+prefix = Project Name (Typically)
+path = /projects/project
+trachost = trac.yourhost.com
+subdomain = campfire_subdomain
+apitoken = yourCampfireAPIToken
+roomid = RoomID
+
+You can find your room ID at the tail end of the URL when you are in your chat room.
+
+Add the following to the [components]
section:
+
+campfirelistener.* = enabled
-setup.py
will create several subdirectories. The TracCampfireListener-0.1-py2.5.egg
file is located in the dist
directory. Copy it to the plugins
directory of your local trac project folder (/var/lib/trac/your_project/plugins
for instance). Chmod it and restart Apache for trac to use the plugin. That should be it.
\ No newline at end of file