From f29b9f14fd392e52cb41f0903be49e44aa210716 Mon Sep 17 00:00:00 2001 From: Eeshan Garg Date: Sat, 21 Apr 2018 16:34:08 -0230 Subject: [PATCH] integrations: Update docs for git and codebase. Doing both as once due to the common dependency on change-zulip-config-file-indented.md. --- .../change-zulip-config-file-indented.md | 6 +-- templates/zerver/integrations/codebase.md | 36 ++++++++-------- templates/zerver/integrations/git.md | 41 ++++++++++--------- zerver/lib/integrations.py | 3 +- 4 files changed, 44 insertions(+), 42 deletions(-) diff --git a/templates/zerver/help/include/change-zulip-config-file-indented.md b/templates/zerver/help/include/change-zulip-config-file-indented.md index cefc63889f..0e742aacfc 100644 --- a/templates/zerver/help/include/change-zulip-config-file-indented.md +++ b/templates/zerver/help/include/change-zulip-config-file-indented.md @@ -1,8 +1,4 @@ - On your {{ settings_html|safe }}, create a bot for - {{ integration_display_name }}. - - Next, open - `integrations/{{ integration_name }}/zulip_{{ integration_name }}_config.py` + Open `integrations/{{ integration_name }}/zulip_{{ integration_name }}_config.py` with your favorite editor, and change the following lines to specify the email address and API key for your {{ integration_display_name }} bot: diff --git a/templates/zerver/integrations/codebase.md b/templates/zerver/integrations/codebase.md index e28c9c1df3..9f7bf00072 100644 --- a/templates/zerver/integrations/codebase.md +++ b/templates/zerver/integrations/codebase.md @@ -1,35 +1,39 @@ +Get Codebase notifications in Zulip! + 1. First, create the streams you’d like to use for Codebase notifications. There - will be two types of messages: commit-related updates and issue-related updates. - After creating these streams (we suggest naming them `codebase commits` and - `codebase issues`), make sure to subscribe all interested parties. + will be two types of messages: commit-related updates and issue-related + updates. We recommend naming the streams `codebase` and `tickets`, respectively. + After creating these streams, make sure to subscribe all interested parties. -2. {!download-python-bindings.md!} +1. {!create-a-bot-indented.md!} -3. You will need your Codebase API Username. You can find it in the settings page - of your account, under **API Credentials**. +1. {!download-python-bindings.md!} -4. {!change-zulip-config-file-indented.md!} +1. {!change-zulip-config-file-indented.md!} -5. Also, edit the following Codebase credentials in `zulip_codebase_config.py`: + You may also need to update the value of `ZULIP_TICKETS_STREAM_NAME` and + `ZULIP_COMMITS_STREAM_NAME`. + +1. Go to your Codebase settings, and click on **My Profile**. Under + **API Credentials**, you will find your API key and username. + Edit the following lines in `zulip_codebase_config.py` to add your Codebase + credentials: ``` CODEBASE_API_USERNAME = "zulip-inc/leo-franchi-15" CODEBASE_API_KEY = 0123456789abcdef0123456789abcdef ``` -6. Before your first run of the script, you may optionally choose to configure it - to mirror some number of hours of prior Codebase activity: + Before your first run of the script, you may also want to configure the + integration to mirror some number of hours of prior Codebase activity: ``` CODEBASE_INITIAL_HISTORY_HOURS = 10 ``` -7. Now, simply run the `api/integrations/codebase/zulip_codebase_mirror` script. - If needed, this script may be restarted, and it will automatically resume from - when it was last running. - -8. Whenever you create a new project, commit, issue, deployment, or more, you’ll - get notifications in your selected streams with the associated information. +1. Run the `/usr/local/share/zulip/integrations/codebase/zulip_codebase_mirror` + script. If needed, this script may be restarted, and it will automatically + resume from when it was last running. {!congrats.md!} diff --git a/templates/zerver/integrations/git.md b/templates/zerver/integrations/git.md index c7c43f610c..b27f310713 100644 --- a/templates/zerver/integrations/git.md +++ b/templates/zerver/integrations/git.md @@ -1,30 +1,31 @@ -{!download-python-bindings.md!} +Get Zulip notifications for your Git repositories! -{!create-stream.md!} +1. {!create-a-bot-indented.md!} -{!change-zulip-config-file.md!} +1. {!download-python-bindings.md!} -You can also specify which pushes will result in notifications and to -what stream the notifications will be sent by modifying the -`commit_notice_destination` function in `zulip_git_config.py`. By -default, pushes to the `master` and `test-post-receive` branches will -result in a notification to the stream `commits`. +1. {!create-stream.md!} -Save `integrations/git/zulip_git_config.py` to the `.git/hooks` -directory of your git repository. +1. {!change-zulip-config-file-indented.md!} -Symlink `/usr/local/share/zulip/integrations/git/post-receive` to -the `.git/hooks` directory of your git repository. + You may also need to change the value of `STREAM_NAME`. -Whenever you make a push to the `master` branch of your git repository -(or whatever you configured above), the Zulip git plugin will send an -automated notification. + You can specify the branches that will be used for notifications by modifying + the `commit_notice_destination` function. By default, + pushes to the `master` and `test-post-receive` branches will result in a + notification. + +1. Symlink `/usr/local/share/zulip/integrations/git/zulip_git_config.py` + to the `.git/hooks` directory of your git repository. + +1. Symlink `/usr/local/share/zulip/integrations/git/post-receive` + to the `.git/hooks` directory of your git repository. + +!!! tip "" + + You can test the plugin without changing your `master` branch by + pushing to the `test-post-receive` branch. {!congrats.md!} ![](/static/images/integrations/git/001.png) - -**Testing** - -You can test the plugin without changing your `master` branch by -pushing to the `test-post-receive` branch. diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.py index ccbfbfee2a..286b02dda8 100644 --- a/zerver/lib/integrations.py +++ b/zerver/lib/integrations.py @@ -383,7 +383,8 @@ INTEGRATIONS = { doc='zerver/integrations/email.md'), 'errbot': Integration('errbot', 'errbot', ['meta-integration', 'bots'], doc='zerver/integrations/errbot.md'), - 'git': Integration('git', 'git', ['version-control'], doc='zerver/integrations/git.md'), + 'git': Integration('git', 'git', ['version-control'], + stream_name='commits', doc='zerver/integrations/git.md'), 'google-calendar': Integration( 'google-calendar', 'google-calendar',