Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH pages: fix/imp #17

Merged
merged 3 commits into from
Nov 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions oca_repo_maintainer/tools/gh_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
self.conf_dir = conf_dir
self.conf_loader = ConfLoader(conf_dir)
self.org = org
self.conf_global = self.conf_loader.load_conf("global")
self.conf_psc = self.conf_loader.load_conf("psc")
self.conf_repo = self.conf_loader.load_conf("repo")
self.conf_global = self.conf_loader.load_conf("global", checksum=False)
self.conf_psc = self.conf_loader.load_conf("psc", checksum=False)
self.conf_repo = self.conf_loader.load_conf("repo", checksum=False)

Check warning on line 26 in oca_repo_maintainer/tools/gh_pages.py

View check run for this annotation

Codecov / codecov/patch

oca_repo_maintainer/tools/gh_pages.py#L24-L26

Added lines #L24 - L26 were not covered by tests
self.page_folder = page_folder

def run(self):
Expand All @@ -42,6 +42,8 @@
for repo_slug, data in self.conf_repo.items():
cat = data.get("category") or "Uncategorized"
res.setdefault(cat, []).append((repo_slug, data))
for categ, repos in res.items():
res[categ] = sorted(repos)

Check warning on line 46 in oca_repo_maintainer/tools/gh_pages.py

View check run for this annotation

Codecov / codecov/patch

oca_repo_maintainer/tools/gh_pages.py#L46

Added line #L46 was not covered by tests
return res

def _generate_repo_pages(self):
Expand Down Expand Up @@ -79,6 +81,9 @@
for member in self._link_users(*data["maintainers"]):
section.append("* " + member)
section.append("")
if repo_slug != repos[-1][0]:
# add horiz separator except for the last one
section.append("\n----\n")

Check warning on line 86 in oca_repo_maintainer/tools/gh_pages.py

View check run for this annotation

Codecov / codecov/patch

oca_repo_maintainer/tools/gh_pages.py#L86

Added line #L86 was not covered by tests
content = "\n".join(section)
self.write(content, Path(f"docsource/{categ.lower()}.rst"))

Expand All @@ -87,24 +92,26 @@
============

.. toctree::
:maxdepth: 1


"""
categories = list(repo_by_category.keys())
categories = sorted(repo_by_category.keys())

Check warning on line 98 in oca_repo_maintainer/tools/gh_pages.py

View check run for this annotation

Codecov / codecov/patch

oca_repo_maintainer/tools/gh_pages.py#L98

Added line #L98 was not covered by tests
no_cat = "Uncategorized"
if no_cat in categories:
# move uncategorized repos at the end
categories.remove(no_cat)
categories.append(no_cat)

for categ in categories:
content += f" {categ.lower()}\n"
content += f" {categ.lower()}.rst\n"

Check warning on line 106 in oca_repo_maintainer/tools/gh_pages.py

View check run for this annotation

Codecov / codecov/patch

oca_repo_maintainer/tools/gh_pages.py#L106

Added line #L106 was not covered by tests
self.write(content, Path("docsource/repos.rst"))

def _generate_psc_pages(self):
section = ["Teams", "====="]
for _psc_slug, data in self.conf_psc.items():
psc_name = data["name"]
psc_data = sorted(
[(data["name"], slug, data) for slug, data in self.conf_psc.items()]
)
for psc_name, ___, data in psc_data:
section.append(psc_name)
section.append("*" * len(psc_name))
section.append("")
Expand All @@ -119,7 +126,9 @@
section.append("")
for member in self._link_users(*data["representatives"]):
section.append("* " + member)
section.append("")
if psc_name != psc_data[-1][0]:
# add horiz separator except for the last one
section.append("\n----\n")

Check warning on line 131 in oca_repo_maintainer/tools/gh_pages.py

View check run for this annotation

Codecov / codecov/patch

oca_repo_maintainer/tools/gh_pages.py#L131

Added line #L131 was not covered by tests
content = "\n".join(section)
self.write(content, Path("docsource/teams.rst"))

Expand Down