mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	Rename Humbug-based variables in Trac plugin.
(imported from commit 5d406cb6c5fe7b1fbd4da706f7ac6bb6e381cadb)
This commit is contained in:
		@@ -21,15 +21,15 @@
 | 
			
		||||
# 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
 | 
			
		||||
# 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]
 | 
			
		||||
# humbug_trac = enabled
 | 
			
		||||
# zulip_trac = enabled
 | 
			
		||||
#
 | 
			
		||||
# You may then need to restart trac (or restart Apache) for the bot
 | 
			
		||||
# (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__))
 | 
			
		||||
import zulip_trac_config as config
 | 
			
		||||
 | 
			
		||||
if config.HUMBUG_API_PATH is not None:
 | 
			
		||||
    sys.path.append(config.HUMBUG_API_PATH)
 | 
			
		||||
if config.ZULIP_API_PATH is not None:
 | 
			
		||||
    sys.path.append(config.ZULIP_API_PATH)
 | 
			
		||||
 | 
			
		||||
import zulip
 | 
			
		||||
client = zulip.Client(
 | 
			
		||||
    email=config.HUMBUG_USER,
 | 
			
		||||
    site=config.HUMBUG_SITE,
 | 
			
		||||
    api_key=config.HUMBUG_API_KEY)
 | 
			
		||||
    email=config.ZULIP_USER,
 | 
			
		||||
    site=config.ZULIP_SITE,
 | 
			
		||||
    api_key=config.ZULIP_API_KEY)
 | 
			
		||||
 | 
			
		||||
def markdown_ticket_url(ticket, heading="ticket"):
 | 
			
		||||
    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)
 | 
			
		||||
            })
 | 
			
		||||
 | 
			
		||||
class HumbugPlugin(Component):
 | 
			
		||||
class ZulipPlugin(Component):
 | 
			
		||||
    implements(ITicketChangeListener)
 | 
			
		||||
 | 
			
		||||
    def ticket_created(self, ticket):
 | 
			
		||||
@@ -20,11 +20,11 @@
 | 
			
		||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
			
		||||
# 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:
 | 
			
		||||
HUMBUG_USER = "trac-bot@example.com"
 | 
			
		||||
HUMBUG_API_KEY = "0123456789abcdef0123456789abcdef"
 | 
			
		||||
ZULIP_USER = "trac-bot@example.com"
 | 
			
		||||
ZULIP_API_KEY = "0123456789abcdef0123456789abcdef"
 | 
			
		||||
STREAM_FOR_NOTIFICATIONS = "trac"
 | 
			
		||||
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
 | 
			
		||||
# triggering a Zulip notification; change these to match your team's
 | 
			
		||||
# workflow.
 | 
			
		||||
TRAC_NOTIFY_FIELDS = ["description", "summary", "resolution", "comment",
 | 
			
		||||
                      "owner"]
 | 
			
		||||
TRAC_NOTIFY_FIELDS = ["description", "summary", "resolution", "comment", "owner"]
 | 
			
		||||
 | 
			
		||||
## If properly installed, the Zulip API should be in your import
 | 
			
		||||
## 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.
 | 
			
		||||
HUMBUG_SITE = "https://api.zulip.com"
 | 
			
		||||
ZULIP_SITE = "https://api.zulip.com"
 | 
			
		||||
 
 | 
			
		||||
@@ -4,12 +4,11 @@
 | 
			
		||||
# Leaving all the instructions out of this file to avoid having to
 | 
			
		||||
# sync them as we update the comments.
 | 
			
		||||
 | 
			
		||||
HUMBUG_USER = "trac-bot@zulip.com"
 | 
			
		||||
HUMBUG_API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
 | 
			
		||||
ZULIP_USER = "trac-bot@zulip.com"
 | 
			
		||||
ZULIP_API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
 | 
			
		||||
STREAM_FOR_NOTIFICATIONS = "trac"
 | 
			
		||||
TRAC_BASE_TICKET_URL = "https://trac.humbughq.com/ticket"
 | 
			
		||||
 | 
			
		||||
TRAC_NOTIFY_FIELDS = ["description", "summary", "resolution", "comment",
 | 
			
		||||
                      "owner"]
 | 
			
		||||
HUMBUG_API_PATH = "/home/humbug/humbug/api"
 | 
			
		||||
HUMBUG_SITE = "https://staging.zulip.com"
 | 
			
		||||
TRAC_NOTIFY_FIELDS = ["description", "summary", "resolution", "comment", "owner"]
 | 
			
		||||
ZULIP_API_PATH = "/home/humbug/humbug/api"
 | 
			
		||||
ZULIP_SITE = "https://staging.zulip.com"
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ max_diff_files = 0
 | 
			
		||||
wiki_format_messages = true
 | 
			
		||||
 | 
			
		||||
[components]
 | 
			
		||||
humbug_trac = enabled
 | 
			
		||||
zulip_trac = enabled
 | 
			
		||||
 | 
			
		||||
[header_logo]
 | 
			
		||||
alt = Zulip
 | 
			
		||||
 
 | 
			
		||||
@@ -19,9 +19,9 @@ class zulip::trac {
 | 
			
		||||
    source => "puppet:///modules/zulip/trac.ini",
 | 
			
		||||
    require => User['humbug'],
 | 
			
		||||
  }
 | 
			
		||||
  file { '/home/humbug/trac/plugins/humbug_trac.py':
 | 
			
		||||
  file { '/home/humbug/trac/plugins/zulip_trac.py':
 | 
			
		||||
    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':
 | 
			
		||||
    ensure => 'link',
 | 
			
		||||
 
 | 
			
		||||
@@ -466,21 +466,21 @@ x      <p><code>https://api.zulip.com/v1/external/pivotal?api_key=abcdefgh&s
 | 
			
		||||
      notification messages to go (by default,
 | 
			
		||||
      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>
 | 
			
		||||
<span class="n">HUMBUG_API_KEY</span> <span class="o">=</span> <span class="s">"0123456789abcdef0123456789abcdef"</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">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">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
 | 
			
		||||
      your Trac installation's <code>plugins/</code>
 | 
			
		||||
      subdirectory. Once you've done that, edit your Trac
 | 
			
		||||
      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>
 | 
			
		||||
 | 
			
		||||
<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>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user