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.
|
||||
* `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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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])
|
||||
|
||||
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue