mirror of https://github.com/zulip/zulip.git
refactor: Relocate screenshots scripts to new tools/screenshots dir.
This commit relocates all the scripts in the tools directory which are used for auto-generating screenshots to the new tools/screenshots directory to avoid cluttering the tools/ root.
This commit is contained in:
parent
c41a352a12
commit
0a7c0ea326
|
@ -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.
|
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
|
* `static/images/integrations/mywebhook/001.png`: A screenshot of a message
|
||||||
sent by the integration, used on the documentation page. This can be
|
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
|
* `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
|
platform/server/product you are integrating which is used to create the avatar
|
||||||
for generating screenshots with. This can be generated automatically from
|
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
|
`zerver/webhooks/mywebhook/view.py`. Also add your integration to
|
||||||
`DOC_SCREENSHOT_CONFIG`. This will allow you to automatically generate
|
`DOC_SCREENSHOT_CONFIG`. This will allow you to automatically generate
|
||||||
a screenshot for the documentation by running
|
a screenshot for the documentation by running
|
||||||
`tools/generate-integration-docs-screenshot --integration mywebhook`.
|
`tools/screenshots/generate-integration-docs-screenshot --integration mywebhook`.
|
||||||
|
|
||||||
## Common Helpers
|
## Common Helpers
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,10 @@ Usually, this involves a few steps:
|
||||||
the message to provide an example message in the documentation.
|
the message to provide an example message in the documentation.
|
||||||
|
|
||||||
If your new integration is an incoming webhook integration, you can generate
|
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
|
```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
|
If you have trouble using this tool, you can also manually generate the
|
||||||
|
|
|
@ -9,7 +9,8 @@ import sys
|
||||||
from typing import Any, Dict, Optional, Tuple
|
from typing import Any, Dict, Optional, Tuple
|
||||||
from urllib.parse import parse_qsl, urlencode
|
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)
|
ROOT_DIR = os.path.dirname(TOOLS_DIR)
|
||||||
sys.path.insert(0, ROOT_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}")
|
print(f"No message found for {bot.full_name}")
|
||||||
return
|
return
|
||||||
message_id = str(message.id)
|
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])
|
subprocess.check_call(["node", screenshot_script, message_id, image_path, realm.url])
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ class IntegrationsTestCase(ZulipTestCase):
|
||||||
message = (
|
message = (
|
||||||
'"{path}" does not exist for webhook {webhook_name}.\n'
|
'"{path}" does not exist for webhook {webhook_name}.\n'
|
||||||
"Consider updating zerver.lib.integrations.DOC_SCREENSHOT_CONFIG\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:
|
for integration_name in DOC_SCREENSHOT_CONFIG:
|
||||||
configs = DOC_SCREENSHOT_CONFIG[integration_name]
|
configs = DOC_SCREENSHOT_CONFIG[integration_name]
|
||||||
|
|
Loading…
Reference in New Issue