Skip to content

Commit

Permalink
[chores] Added index.html that redirects to stable version
Browse files Browse the repository at this point in the history
  • Loading branch information
pandafy committed Feb 22, 2024
1 parent 71b4789 commit d710183
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 11 deletions.
8 changes: 8 additions & 0 deletions _static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; URL='/stable/index.html'" />
</head>
<body>
</body>
</html>
5 changes: 3 additions & 2 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,16 +449,17 @@
smv_branch_whitelist = 'master'
smv_tag_whitelist = r'^.*$'


# Configuration for generating comprehensive docs
import yaml
import os
import yaml

with open('config.yml', 'r') as f:
ow_docs_config = yaml.safe_load(f)

html_context = {
'current_ow_version': os.environ.get('OPENWISP2_VERSION', 'stable'),
'ow_versions': []
'ow_versions': [],
}

for ow_version in ow_docs_config['versions']:
Expand Down
12 changes: 6 additions & 6 deletions config.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---

versions:
- name: latest
modules:
- name: openwisp-firmware-upgrader
branch: reorder-docs
- name: openwisp-controller
branch: reorder-docs
- name: stable
modules:
- name: openwisp-firmware-upgrader
branch: reorder-docs-stable
- name: openwisp-controller
branch: reorder-docs-stable
- name: latest
modules:
- name: openwisp-firmware-upgrader
branch: reorder-docs
- name: openwisp-controller
branch: reorder-docs
16 changes: 13 additions & 3 deletions pulling_modules.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import shutil
import subprocess

import yaml
Expand All @@ -10,16 +11,24 @@ def clone_or_update_repo(module_name, branch):

if os.path.exists(repo_path):
print(f"Repository '{module_name}' already exists. Updating...")
subprocess.run(['git', 'remote', 'set-branches', 'origin', branch], cwd=repo_path, check=True)
subprocess.run(['git', 'fetch', '--update-shallow', 'origin', branch], cwd=repo_path, check=True)
subprocess.run(
['git', 'remote', 'set-branches', 'origin', branch],
cwd=repo_path,
check=True,
)
subprocess.run(
['git', 'fetch', '--update-shallow', 'origin', branch],
cwd=repo_path,
check=True,
)
subprocess.run(['git', 'checkout', branch], cwd=repo_path, check=True)
else:
print(f"Cloning repository '{module_name}'...")
subprocess.run(
[
'git',
'clone',
# '--single-branch',
'--single-branch',
'--branch',
branch,
'--depth',
Expand Down Expand Up @@ -53,6 +62,7 @@ def main():
subprocess.run(
['sphinx-build', '-b', 'html', '.', f'_build/{version_name}'], check=True
)
shutil.copy('_static/index.html', '_build/index.html')


if __name__ == "__main__":
Expand Down

0 comments on commit d710183

Please sign in to comment.