Skip to content

Commit

Permalink
Add specsanalyzer docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rettigl committed Dec 20, 2024
1 parent e368c22 commit 3220c9b
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
11 changes: 11 additions & 0 deletions specsanalyzer/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>sed-processor documentation</title>
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="0; URL=https://opencompes.github.io/docs/sed/stable/" />
</head>
<body>
<p><a href="https://opencompes.github.io/docs/sed/stable/">Here</a> you find the last stable documentation of sed-processor.</p>
</body>
</html>
13 changes: 13 additions & 0 deletions specsanalyzer/switcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"name": "latest",
"version": "0.3.3a3",
"url": "https://opencompes.github.io/docs/specsanalyzer/latest"
},
{
"name": "stable",
"version": "0.3.2",
"url": "https://opencompes.github.io/docs/specsanalyzer/v0.3.2",
"preferred": "true"
}
]
58 changes: 58 additions & 0 deletions specsanalyzer/update_switcher.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import json
import sys

if len(sys.argv) != 4:
sys.exit("Usage: update_switcher.py json_file GITHUB_REF VERSION")

switcher_file = sys.argv[1]
branch = sys.argv[2]
version = sys.argv[3]

present = False
with open(switcher_file, encoding="utf-8") as f:
data = json.load(f)
if branch.startswith("refs/tags"): # add a new version tag
version_tag = branch.split("/")[-1]
for item in data:
if version_tag in item.get("name", ""):
present = True
if "stable" in item.get("name", ""):
item["version"] = version
item["url"] = "https://opencompes.github.io/docs/specsanalyzer/" + version_tag
if not present:
new_entry = {}
new_entry["name"] = version_tag
new_entry["version"] = version
new_entry["url"] = "https://opencompes.github.io/docs/specsanalyzer/" + version_tag
data.append(new_entry)

elif branch == "refs/heads/main": # update latest
for item in data:
if "latest" in item.get("name", ""):
item["version"] = version
present = True
break
if not present:
new_entry = {}
new_entry["name"] = "latest"
new_entry["version"] = version
new_entry["url"] = "https://opencompes.github.io/docs/specsanalyzer/latest"
data.append(new_entry)

else: # update develop
for item in data:
if "develop" in item.get("name", ""):
present = True
item["version"] = version
break
if not present:
new_entry = {}
new_entry["name"] = "develop"
new_entry["version"] = version
new_entry["url"] = "https://opencompes.github.io/docs/specsanalyzer/develop"
data.append(new_entry)

print(data)

with open(switcher_file, mode="w", encoding="utf-8") as f:
json.dump(data, f, indent=2)

0 comments on commit 3220c9b

Please sign in to comment.