prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Documentation: "older version" warning present on latest
  Every page under https://starlite-api.github.io/starlite/latest/ has the "You are viewing the documentation for an older version of Starlite. Click here to get to the latest version" warning, which links back to the welcome page. 
  
  The message is not present in https://starlite-api.github.io/starlite/1.50/, https://starlite-api.github.io/starlite/1.49/, or https://starlite-api.github.io/starlite/1.47/.
  Documentation: "older version" warning present on latest
  Every page under https://starlite-api.github.io/starlite/latest/ has the "You are viewing the documentation for an older version of Starlite. Click here to get to the latest version" warning, which links back to the welcome page. 
  
  The message is not present in https://starlite-api.github.io/starlite/1.50/, https://starlite-api.github.io/starlite/1.49/, or https://starlite-api.github.io/starlite/1.47/.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `tools/publish_docs.py`
  Content:
  ```
  1 import importlib.metadata
  2 import json
  3 import shutil
  4 import subprocess
  5 from pathlib import Path
  6 import argparse
  7 import shutil
  8 
  9 parser = argparse.ArgumentParser()
  10 parser.add_argument("--version", required=False)
  11 parser.add_argument("--push", action="store_true")
  12 parser.add_argument("--latest", action="store_true")
  13 
  14 
  15 def update_versions_file(version: str) -> None:
  16     versions_file = Path("versions.json")
  17     versions = []
  18     if versions_file.exists():
  19         versions = json.loads(versions_file.read_text())
  20 
  21     new_version_spec = {"version": version, "title": version, "aliases": []}
  22     if any(v["version"] == version for v in versions):
  23         versions = [v if v["version"] != version else new_version_spec for v in versions]
  24     else:
  25         versions.insert(0, new_version_spec)
  26 
  27     versions_file.write_text(json.dumps(versions))
  28 
  29 
  30 def make_version(version: str, push: bool, latest: bool) -> None:
  31     subprocess.run(["make", "docs"], check=True)
  32 
  33     subprocess.run(["git", "checkout", "gh-pages"], check=True)
  34 
  35     update_versions_file(version)
  36 
  37     docs_src_path = Path("docs/_build/html")
  38     docs_dest_path = Path(version)
  39     docs_dest_path_latest = Path("latest")
  40     if docs_dest_path.exists():
  41         shutil.rmtree(docs_dest_path)
  42 
  43     docs_src_path.rename(docs_dest_path)
  44     if latest:
  45         if docs_dest_path_latest.exists():
  46             shutil.rmtree(docs_dest_path_latest)
  47         shutil.copytree(docs_dest_path, docs_dest_path_latest)
  48         subprocess.run(["git", "add", "latest"], check=True)
  49 
  50     subprocess.run(["git", "add", version], check=True)
  51     subprocess.run(["git", "add", "versions.json"], check=True)
  52     subprocess.run(["git", "commit", "-m", f"automated docs build: {version}"], check=True)
  53     if push:
  54         subprocess.run(["git", "push"], check=True)
  55     subprocess.run(["git", "checkout", "-"], check=True)
  56 
  57 
  58 def main() -> None:
  59     args = parser.parse_args()
  60     version = args.version or importlib.metadata.version("starlite").rsplit(".", 1)[0]
  61     make_version(version=version, push=args.push, latest=args.latest)
  62 
  63 
  64 if __name__ == "__main__":
  65     main()
  66
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/tools/publish_docs.py b/tools/publish_docs.py
  --- a/tools/publish_docs.py
  +++ b/tools/publish_docs.py
  @@ -12,7 +12,7 @@
   parser.add_argument("--latest", action="store_true")
   
   
  -def update_versions_file(version: str) -> None:
  +def add_to_versions_file(version: str, latest: bool) -> None:
       versions_file = Path("versions.json")
       versions = []
       if versions_file.exists():
  @@ -24,6 +24,11 @@
       else:
           versions.insert(0, new_version_spec)
   
  +    if latest:
  +        for version in versions:
  +            version["aliases"] = []
  +        versions[0]["aliases"] = ["latest"]
  +
       versions_file.write_text(json.dumps(versions))
   
   
  @@ -32,7 +37,7 @@
   
       subprocess.run(["git", "checkout", "gh-pages"], check=True)
   
  -    update_versions_file(version)
  +    add_to_versions_file(version, latest)
   
       docs_src_path = Path("docs/_build/html")
       docs_dest_path = Path(version)
  
verification_info: {"golden_diff": "diff --git a/tools/publish_docs.py b/tools/publish_docs.py\n--- a/tools/publish_docs.py\n+++ b/tools/publish_docs.py\n@@ -12,7 +12,7 @@\n parser.add_argument(\"--latest\", action=\"store_true\")\n \n \n-def update_versions_file(version: str) -> None:\n+def add_to_versions_file(version: str, latest: bool) -> None:\n     versions_file = Path(\"versions.json\")\n     versions = []\n     if versions_file.exists():\n@@ -24,6 +24,11 @@\n     else:\n         versions.insert(0, new_version_spec)\n \n+    if latest:\n+        for version in versions:\n+            version[\"aliases\"] = []\n+        versions[0][\"aliases\"] = [\"latest\"]\n+\n     versions_file.write_text(json.dumps(versions))\n \n \n@@ -32,7 +37,7 @@\n \n     subprocess.run([\"git\", \"checkout\", \"gh-pages\"], check=True)\n \n-    update_versions_file(version)\n+    add_to_versions_file(version, latest)\n \n     docs_src_path = Path(\"docs/_build/html\")\n     docs_dest_path = Path(version)\n", "issue": "Documentation: \"older version\" warning present on latest\nEvery page under https://starlite-api.github.io/starlite/latest/ has the \"You are viewing the documentation for an older version of Starlite. Click here to get to the latest version\" warning, which links back to the welcome page. \r\n\r\nThe message is not present in https://starlite-api.github.io/starlite/1.50/, https://starlite-api.github.io/starlite/1.49/, or https://starlite-api.github.io/starlite/1.47/.\nDocumentation: \"older version\" warning present on latest\nEvery page under https://starlite-api.github.io/starlite/latest/ has the \"You are viewing the documentation for an older version of Starlite. Click here to get to the latest version\" warning, which links back to the welcome page. \r\n\r\nThe message is not present in https://starlite-api.github.io/starlite/1.50/, https://starlite-api.github.io/starlite/1.49/, or https://starlite-api.github.io/starlite/1.47/.\n", "before_files": [{"content": "import importlib.metadata\nimport json\nimport shutil\nimport subprocess\nfrom pathlib import Path\nimport argparse\nimport shutil\n\nparser = argparse.ArgumentParser()\nparser.add_argument(\"--version\", required=False)\nparser.add_argument(\"--push\", action=\"store_true\")\nparser.add_argument(\"--latest\", action=\"store_true\")\n\n\ndef update_versions_file(version: str) -> None:\n    versions_file = Path(\"versions.json\")\n    versions = []\n    if versions_file.exists():\n        versions = json.loads(versions_file.read_text())\n\n    new_version_spec = {\"version\": version, \"title\": version, \"aliases\": []}\n    if any(v[\"version\"] == version for v in versions):\n        versions = [v if v[\"version\"] != version else new_version_spec for v in versions]\n    else:\n        versions.insert(0, new_version_spec)\n\n    versions_file.write_text(json.dumps(versions))\n\n\ndef make_version(version: str, push: bool, latest: bool) -> None:\n    subprocess.run([\"make\", \"docs\"], check=True)\n\n    subprocess.run([\"git\", \"checkout\", \"gh-pages\"], check=True)\n\n    update_versions_file(version)\n\n    docs_src_path = Path(\"docs/_build/html\")\n    docs_dest_path = Path(version)\n    docs_dest_path_latest = Path(\"latest\")\n    if docs_dest_path.exists():\n        shutil.rmtree(docs_dest_path)\n\n    docs_src_path.rename(docs_dest_path)\n    if latest:\n        if docs_dest_path_latest.exists():\n            shutil.rmtree(docs_dest_path_latest)\n        shutil.copytree(docs_dest_path, docs_dest_path_latest)\n        subprocess.run([\"git\", \"add\", \"latest\"], check=True)\n\n    subprocess.run([\"git\", \"add\", version], check=True)\n    subprocess.run([\"git\", \"add\", \"versions.json\"], check=True)\n    subprocess.run([\"git\", \"commit\", \"-m\", f\"automated docs build: {version}\"], check=True)\n    if push:\n        subprocess.run([\"git\", \"push\"], check=True)\n    subprocess.run([\"git\", \"checkout\", \"-\"], check=True)\n\n\ndef main() -> None:\n    args = parser.parse_args()\n    version = args.version or importlib.metadata.version(\"starlite\").rsplit(\".\", 1)[0]\n    make_version(version=version, push=args.push, latest=args.latest)\n\n\nif __name__ == \"__main__\":\n    main()\n", "path": "tools/publish_docs.py"}], "after_files": [{"content": "import importlib.metadata\nimport json\nimport shutil\nimport subprocess\nfrom pathlib import Path\nimport argparse\nimport shutil\n\nparser = argparse.ArgumentParser()\nparser.add_argument(\"--version\", required=False)\nparser.add_argument(\"--push\", action=\"store_true\")\nparser.add_argument(\"--latest\", action=\"store_true\")\n\n\ndef add_to_versions_file(version: str, latest: bool) -> None:\n    versions_file = Path(\"versions.json\")\n    versions = []\n    if versions_file.exists():\n        versions = json.loads(versions_file.read_text())\n\n    new_version_spec = {\"version\": version, \"title\": version, \"aliases\": []}\n    if any(v[\"version\"] == version for v in versions):\n        versions = [v if v[\"version\"] != version else new_version_spec for v in versions]\n    else:\n        versions.insert(0, new_version_spec)\n\n    if latest:\n        for version in versions:\n            version[\"aliases\"] = []\n        versions[0][\"aliases\"] = [\"latest\"]\n\n    versions_file.write_text(json.dumps(versions))\n\n\ndef make_version(version: str, push: bool, latest: bool) -> None:\n    subprocess.run([\"make\", \"docs\"], check=True)\n\n    subprocess.run([\"git\", \"checkout\", \"gh-pages\"], check=True)\n\n    add_to_versions_file(version, latest)\n\n    docs_src_path = Path(\"docs/_build/html\")\n    docs_dest_path = Path(version)\n    docs_dest_path_latest = Path(\"latest\")\n    if docs_dest_path.exists():\n        shutil.rmtree(docs_dest_path)\n\n    docs_src_path.rename(docs_dest_path)\n    if latest:\n        if docs_dest_path_latest.exists():\n            shutil.rmtree(docs_dest_path_latest)\n        shutil.copytree(docs_dest_path, docs_dest_path_latest)\n        subprocess.run([\"git\", \"add\", \"latest\"], check=True)\n\n    subprocess.run([\"git\", \"add\", version], check=True)\n    subprocess.run([\"git\", \"add\", \"versions.json\"], check=True)\n    subprocess.run([\"git\", \"commit\", \"-m\", f\"automated docs build: {version}\"], check=True)\n    if push:\n        subprocess.run([\"git\", \"push\"], check=True)\n    subprocess.run([\"git\", \"checkout\", \"-\"], check=True)\n\n\ndef main() -> None:\n    args = parser.parse_args()\n    version = args.version or importlib.metadata.version(\"starlite\").rsplit(\".\", 1)[0]\n    make_version(version=version, push=args.push, latest=args.latest)\n\n\nif __name__ == \"__main__\":\n    main()\n", "path": "tools/publish_docs.py"}]}