Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

refactor: Relocate screenshots scripts to new tools/screenshots dir.

roanster0070a7c0ea32627
diff --git a/api_docs/incoming-webhooks-overview.md b/api_docs/incoming-webhooks-overview.md
index b423e31bf0d..840df6a91f1 100644
--- a/api_docs/incoming-webhooks-overview.md
+++ b/api_docs/incoming-webhooks-overview.md
@@ -97,7 +97,7 @@ below are for a webhook named `MyWebHook`.
pages as well as the sender's avatar for messages sent by the integration.
* `static/images/integrations/mywebhook/001.png`: A screenshot of a message
sent by the integration, used on the documentation page. This can be
- generated by running `tools/generate-integration-docs-screenshot --integration mywebhook`.
+ generated by running `tools/screenshots/generate-integration-docs-screenshot --integration mywebhook`.
* `static/images/integrations/bot_avatars/mywebhook.png`: A square logo for the
platform/server/product you are integrating which is used to create the avatar
for generating screenshots with. This can be generated automatically from
@@ -113,7 +113,7 @@ below are for a webhook named `MyWebHook`.
`zerver/webhooks/mywebhook/view.py`. Also add your integration to
`DOC_SCREENSHOT_CONFIG`. This will allow you to automatically generate
a screenshot for the documentation by running
- `tools/generate-integration-docs-screenshot --integration mywebhook`.
+ `tools/screenshots/generate-integration-docs-screenshot --integration mywebhook`.
## Common Helpers
diff --git a/docs/documentation/integrations.md b/docs/documentation/integrations.md
index 56792ed47c4..9c45bcceec8 100644
--- a/docs/documentation/integrations.md
+++ b/docs/documentation/integrations.md
@@ -44,10 +44,10 @@ Usually, this involves a few steps:
the message to provide an example message in the documentation.
If your new integration is an incoming webhook integration, you can generate
- the screenshot using `tools/generate-integration-docs-screenshot`:
+ the screenshot using `tools/screenshots/generate-integration-docs-screenshot`:
```bash
- ./tools/generate-integration-docs-screenshot --integration integrationname
+ ./tools/screenshots/generate-integration-docs-screenshot --integration integrationname
```
If you have trouble using this tool, you can also manually generate the
diff --git a/tools/generate-integration-docs-screenshot b/tools/screenshots/generate-integration-docs-screenshot
similarity index 98%
rename from tools/generate-integration-docs-screenshot
rename to tools/screenshots/generate-integration-docs-screenshot
index a81a966250d..6b9fee808af 100755
--- a/tools/generate-integration-docs-screenshot
+++ b/tools/screenshots/generate-integration-docs-screenshot
@@ -9,7 +9,8 @@ import sys
from typing import Any, Dict, Optional, Tuple
from urllib.parse import parse_qsl, urlencode
-TOOLS_DIR = os.path.abspath(os.path.dirname(__file__))
+SCREENSHOTS_DIR = os.path.abspath(os.path.dirname(__file__))
+TOOLS_DIR = os.path.abspath(os.path.dirname(SCREENSHOTS_DIR))
ROOT_DIR = os.path.dirname(TOOLS_DIR)
sys.path.insert(0, ROOT_DIR)
@@ -225,7 +226,7 @@ def capture_last_message_screenshot(bot: UserProfile, image_path: str) -> None:
print(f"No message found for {bot.full_name}")
return
message_id = str(message.id)
- screenshot_script = os.path.join(TOOLS_DIR, "message-screenshot.js")
+ screenshot_script = os.path.join(SCREENSHOTS_DIR, "message-screenshot.js")
subprocess.check_call(["node", screenshot_script, message_id, image_path, realm.url])
diff --git a/tools/message-screenshot.js b/tools/screenshots/message-screenshot.js
similarity index 100%
rename from tools/message-screenshot.js
rename to tools/screenshots/message-screenshot.js
diff --git a/zerver/tests/test_integrations.py b/zerver/tests/test_integrations.py
index 8ececba3492..a12f128e149 100644
--- a/zerver/tests/test_integrations.py
+++ b/zerver/tests/test_integrations.py
@@ -62,7 +62,7 @@ class IntegrationsTestCase(ZulipTestCase):
message = (
'"{path}" does not exist for webhook {webhook_name}.\n'
"Consider updating zerver.lib.integrations.DOC_SCREENSHOT_CONFIG\n"
- 'and running "tools/generate-integration-docs-screenshot" to keep the screenshots up-to-date.'
+ 'and running "tools/screenshots/generate-integration-docs-screenshot" to keep the screenshots up-to-date.'
)
for integration_name in DOC_SCREENSHOT_CONFIG:
configs = DOC_SCREENSHOT_CONFIG[integration_name]