Rename Humbug-based variables in Trac plugin.

(imported from commit 5d406cb6c5fe7b1fbd4da706f7ac6bb6e381cadb)
This commit is contained in:
Tim Abbott
2013-08-07 12:01:49 -04:00
committed by Tim Abbott
parent 6550134b3e
commit 3005792734
6 changed files with 28 additions and 30 deletions

View File

@@ -21,15 +21,15 @@
# THE SOFTWARE. # THE SOFTWARE.
# Zulip trac plugin -- sends humbugs when tickets change. # Zulip trac plugin -- sends zulips when tickets change.
# #
# Install by copying this file and zulip_trac_config.py to the trac # Install by copying this file and zulip_trac_config.py to the trac
# plugins/ subdirectory, customizing the constants in # plugins/ subdirectory, customizing the constants in
# zulip_trac_config.py, and then adding "humbug_trac" to the # zulip_trac_config.py, and then adding "zulip_trac" to the
# components section of the conf/trac.ini file, like so: # components section of the conf/trac.ini file, like so:
# #
# [components] # [components]
# humbug_trac = enabled # zulip_trac = enabled
# #
# You may then need to restart trac (or restart Apache) for the bot # You may then need to restart trac (or restart Apache) for the bot
# (or changes to the bot) to actually be loaded by trac. # (or changes to the bot) to actually be loaded by trac.
@@ -41,14 +41,14 @@ import os.path
sys.path.insert(0, os.path.dirname(__file__)) sys.path.insert(0, os.path.dirname(__file__))
import zulip_trac_config as config import zulip_trac_config as config
if config.HUMBUG_API_PATH is not None: if config.ZULIP_API_PATH is not None:
sys.path.append(config.HUMBUG_API_PATH) sys.path.append(config.ZULIP_API_PATH)
import zulip import zulip
client = zulip.Client( client = zulip.Client(
email=config.HUMBUG_USER, email=config.ZULIP_USER,
site=config.HUMBUG_SITE, site=config.ZULIP_SITE,
api_key=config.HUMBUG_API_KEY) api_key=config.ZULIP_API_KEY)
def markdown_ticket_url(ticket, heading="ticket"): def markdown_ticket_url(ticket, heading="ticket"):
return "[%s #%s](%s/%s)" % (heading, ticket.id, config.TRAC_BASE_TICKET_URL, ticket.id) return "[%s #%s](%s/%s)" % (heading, ticket.id, config.TRAC_BASE_TICKET_URL, ticket.id)
@@ -72,7 +72,7 @@ def send_update(ticket, content):
"subject": trac_subject(ticket) "subject": trac_subject(ticket)
}) })
class HumbugPlugin(Component): class ZulipPlugin(Component):
implements(ITicketChangeListener) implements(ITicketChangeListener)
def ticket_created(self, ticket): def ticket_created(self, ticket):

View File

@@ -20,11 +20,11 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
# See humbug_trac.py for installation and configuration instructions # See zulip_trac.py for installation and configuration instructions
# Change these constants to configure the plugin: # Change these constants to configure the plugin:
HUMBUG_USER = "trac-bot@example.com" ZULIP_USER = "trac-bot@example.com"
HUMBUG_API_KEY = "0123456789abcdef0123456789abcdef" ZULIP_API_KEY = "0123456789abcdef0123456789abcdef"
STREAM_FOR_NOTIFICATIONS = "trac" STREAM_FOR_NOTIFICATIONS = "trac"
TRAC_BASE_TICKET_URL = "https://trac.example.com/ticket" TRAC_BASE_TICKET_URL = "https://trac.example.com/ticket"
@@ -41,12 +41,11 @@ TRAC_BASE_TICKET_URL = "https://trac.example.com/ticket"
# The following is the list of fields which can be changed without # The following is the list of fields which can be changed without
# triggering a Zulip notification; change these to match your team's # triggering a Zulip notification; change these to match your team's
# workflow. # workflow.
TRAC_NOTIFY_FIELDS = ["description", "summary", "resolution", "comment", TRAC_NOTIFY_FIELDS = ["description", "summary", "resolution", "comment", "owner"]
"owner"]
## If properly installed, the Zulip API should be in your import ## If properly installed, the Zulip API should be in your import
## path, but if not, set a custom path below ## path, but if not, set a custom path below
HUMBUG_API_PATH = None ZULIP_API_PATH = None
# This should not need to change unless you have a custom Zulip subdomain. # This should not need to change unless you have a custom Zulip subdomain.
HUMBUG_SITE = "https://api.zulip.com" ZULIP_SITE = "https://api.zulip.com"

View File

@@ -4,12 +4,11 @@
# Leaving all the instructions out of this file to avoid having to # Leaving all the instructions out of this file to avoid having to
# sync them as we update the comments. # sync them as we update the comments.
HUMBUG_USER = "trac-bot@zulip.com" ZULIP_USER = "trac-bot@zulip.com"
HUMBUG_API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ZULIP_API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
STREAM_FOR_NOTIFICATIONS = "trac" STREAM_FOR_NOTIFICATIONS = "trac"
TRAC_BASE_TICKET_URL = "https://trac.humbughq.com/ticket" TRAC_BASE_TICKET_URL = "https://trac.humbughq.com/ticket"
TRAC_NOTIFY_FIELDS = ["description", "summary", "resolution", "comment", TRAC_NOTIFY_FIELDS = ["description", "summary", "resolution", "comment", "owner"]
"owner"] ZULIP_API_PATH = "/home/humbug/humbug/api"
HUMBUG_API_PATH = "/home/humbug/humbug/api" ZULIP_SITE = "https://staging.zulip.com"
HUMBUG_SITE = "https://staging.zulip.com"

View File

@@ -23,7 +23,7 @@ max_diff_files = 0
wiki_format_messages = true wiki_format_messages = true
[components] [components]
humbug_trac = enabled zulip_trac = enabled
[header_logo] [header_logo]
alt = Zulip alt = Zulip

View File

@@ -19,9 +19,9 @@ class zulip::trac {
source => "puppet:///modules/zulip/trac.ini", source => "puppet:///modules/zulip/trac.ini",
require => User['humbug'], require => User['humbug'],
} }
file { '/home/humbug/trac/plugins/humbug_trac.py': file { '/home/humbug/trac/plugins/zulip_trac.py':
ensure => 'link', ensure => 'link',
target => '/home/humbug/humbug/api/integrations/trac/humbug_trac.py', target => '/home/humbug/humbug/api/integrations/trac/zulip_trac.py',
} }
file { '/home/humbug/trac/plugins/zulip_trac_config.py': file { '/home/humbug/trac/plugins/zulip_trac_config.py':
ensure => 'link', ensure => 'link',

View File

@@ -466,21 +466,21 @@ x <p><code>https://api.zulip.com/v1/external/pivotal?api_key=abcdefgh&amp;s
notification messages to go (by default, notification messages to go (by default,
stream <code>trac</code>):</p> stream <code>trac</code>):</p>
<div class="codehilite"><pre><span class="n">HUMBUG_USER</span> <span class="o">=</span> <span class="s">"trac-notifications-bot@example.com"</span> <div class="codehilite"><pre><span class="n">ZULIP_USER</span> <span class="o">=</span> <span class="s">"trac-notifications-bot@example.com"</span>
<span class="n">HUMBUG_API_KEY</span> <span class="o">=</span> <span class="s">"0123456789abcdef0123456789abcdef"</span> <span class="n">ZULIP_API_KEY</span> <span class="o">=</span> <span class="s">"0123456789abcdef0123456789abcdef"</span>
<span class="n">STREAM_FOR_NOTIFICATIONS</span> <span class="o">=</span> <span class="s">"trac"</span> <span class="n">STREAM_FOR_NOTIFICATIONS</span> <span class="o">=</span> <span class="s">"trac"</span>
<span class="n">TRAC_BASE_TICKET_URL</span> <span class="o">=</span> <span class="s">"https://trac.example.com/ticket"</span></pre></div> <span class="n">TRAC_BASE_TICKET_URL</span> <span class="o">=</span> <span class="s">"https://trac.example.com/ticket"</span></pre></div>
<p>Copy <code>integrations/trac/humbug_trac.py</code> <p>Copy <code>integrations/trac/zulip_trac.py</code>
and <code>integrations/trac/zulip_trac_config.py</code> into and <code>integrations/trac/zulip_trac_config.py</code> into
your Trac installation's <code>plugins/</code> your Trac installation's <code>plugins/</code>
subdirectory. Once you've done that, edit your Trac subdirectory. Once you've done that, edit your Trac
installation's <code>conf/trac.ini</code> to installation's <code>conf/trac.ini</code> to
add <code>humbug_trac</code> to the <code>[components]</code> add <code>zulip_trac</code> to the <code>[components]</code>
section, as follows:</p> section, as follows:</p>
<div class="codehilite"><pre><span class="k">[components]</span> <div class="codehilite"><pre><span class="k">[components]</span>
<span class="na">humbug_trac</span> <span class="o">=</span> <span class="s">enabled</span></pre></div> <span class="na">zulip_trac</span> <span class="o">=</span> <span class="s">enabled</span></pre></div>
<p>You may then need to restart Trac (or Apache) so that Trac will load our plugin.</p> <p>You may then need to restart Trac (or Apache) so that Trac will load our plugin.</p>