Skip to content

Commit

Permalink
Updating docs-server docs and making it more reliable.
Browse files Browse the repository at this point in the history
  • Loading branch information
robotrapta committed Oct 18, 2023
1 parent 0e3446a commit 2daa983
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
2 changes: 2 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ make develop-docs-comprehensive

and then open [http://localhost:3000/python-sdk](http://localhost:3000/python-sdk).

Or if you're feeling luck, you can try `./start_docs_server.sh` which also rebuilds the sphinx docs on every change.
This script is tested on MacOS with [homebrew](https://brew.sh/) installed, but could work elsewhere too.

## Running docs tests

Expand Down
35 changes: 27 additions & 8 deletions start_docs_server.sh → docs/start_docs_server.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
#!/bin/bash
# convient script to run the docs server. It automatically rebuilds and restarts when you change code. You just need to refresh your browser.
cd "$(dirname "$0")"

check_dependencies() {
if ! command -v fswatch &> /dev/null
then
# if homebrew is installed, install fswatch
if command -v brew &> /dev/null
then
echo "Installing fswatch..."
brew install fswatch
# check that fswatch is installed
if ! command -v fswatch &> /dev/null
then
echo "ERROR: fswatch failed to install. Please install it manually."
exit 1
fi
else
echo "ERROR: fswatch is not installed. Please install it using your package manager or homebrew."
exit 1
fi
fi
}

check_dependencies

cd "$(dirname "$0")"/..
WATCH_PATH="."
START_SERVER_CMD="make develop-docs-comprehensive"
while true; do
Expand All @@ -11,13 +35,8 @@ while true; do
echo "Waiting for 15 seconds before starting to watch for file changes..."
sleep 15

if [[ "$OSTYPE" == "darwin"* ]]; then
CHANGED_FILE=$(fswatch -1 --exclude 'docs/static/api-reference-docs' --exclude 'build/' --exclude '/docs/.docusaurus' --exclude 'changes.log' --exclude 'docs/node_modules/.cache/webpack' --exclude '.git/' $WATCH_PATH)
echo "Detected changes in: $CHANGED_FILE"
else
echo "OS not supported"
exit 1
fi
CHANGED_FILE=$(fswatch -1 --exclude 'docs/static/api-reference-docs' --exclude 'build/' --exclude '/docs/.docusaurus' --exclude 'changes.log' --exclude 'docs/node_modules/.cache/webpack' --exclude '.git/' $WATCH_PATH)
echo "Detected changes in: $CHANGED_FILE"

echo "Code changed. Attempting to kill server on port 3000..."

Expand Down

0 comments on commit 2daa983

Please sign in to comment.