diff --git a/docs/sections/help/index.md b/docs/sections/help/index.md index 9e2e01f..7f75cab 100644 --- a/docs/sections/help/index.md +++ b/docs/sections/help/index.md @@ -11,7 +11,16 @@ Don't hesitate to contact us! --- -## Quick Links (WIP) +## Quick Links + +!!! note "About versions" + + The `version` column is the latest on main and it's what we publish. + + You might encounter some unreleased content live, but plugins usually release often. + Also, we try to include version information on the docs itself. + +### Content Plugins {% for repo_type in ("core", "content") %} Repo | Version | Links |   |   @@ -21,6 +30,24 @@ Repo | Version | Links |   |   {% endfor %} {% endfor %} +### Deployment + +Repo | Version | Links |   +--- | --- | --- | --- +{% for repo in get_repos("deployment") -%} +{{ repo.title }} | `{{ repo.version }}` | {{ repo.codebase_link }} | {{ repo.changes_link }} +{% endfor %} + +### Interaction + +Repo | Version | Links |   +--- | --- | --- | --- +{% for repo in get_repos("interaction") -%} +{{ repo.title }} | `{{ repo.version }}` | {{ repo.codebase_link }} | {{ repo.changes_link }} +{% endfor %} + +### Others + Repo | Version | Links |   --- | --- | --- | --- {% for repo in get_repos("other") -%} diff --git a/src/pulp_docs/mkdocs_macros.py b/src/pulp_docs/mkdocs_macros.py index 09a70eb..4def989 100644 --- a/src/pulp_docs/mkdocs_macros.py +++ b/src/pulp_docs/mkdocs_macros.py @@ -118,6 +118,7 @@ def prepare_repositories(TMPDIR: Path, repos: Repos, config: Config): ) else: this_src_dir = repo_sources / repo_or_pkg.subpackage_of / repo_or_pkg.name + repo_or_pkg.version = f"same as {repo_or_pkg.subpackage_of}" # restapi if has_restapi(repo_or_pkg): @@ -432,8 +433,10 @@ def get_repos(repo_type="content"): ) repos_data = [ { - "title": repo.title, - "version": "3.12.1", + "title": "[{title}](site:{name}/)".format( + title=repo.title, name=repo.name + ), + "version": repo.version or "unknonwn", "restapi_link": MD_LINK.format( title="REST API", path=f"{repo.name}/restapi/" ), @@ -441,7 +444,9 @@ def get_repos(repo_type="content"): title="Changelog", path=f"{repo.name}/changes/" ), "codebase_link": GITHUB_LINK.format( - title="Codebase", owner=repo.owner, name=repo.name + title="Repository", + owner=repo.owner or "pulp", + name=getattr(repo, "subpackage_of", repo.name), ), } for repo in repos_list diff --git a/src/pulp_docs/repository.py b/src/pulp_docs/repository.py index 194731d..d3866c7 100644 --- a/src/pulp_docs/repository.py +++ b/src/pulp_docs/repository.py @@ -17,6 +17,8 @@ from pathlib import Path import httpx +import configparser +import tomli import yaml from pulp_docs.utils.general import get_git_ignored_files @@ -64,6 +66,7 @@ class Repo: status: RepoStatus = field(default_factory=lambda: RepoStatus()) type: t.Optional[str] = None dev_only: bool = False + version: t.Optional[str] = None def __post_init__(self): self.branch_in_use = self.branch_in_use or self.branch @@ -139,6 +142,22 @@ def download( dirs_exist_ok=True, ) + # get version + version_file = src_copy_path / ".bumpversion.cfg" + if version_file.exists(): + config = configparser.ConfigParser() + config.read(version_file) + self.version = config["bumpversion"]["current_version"] + else: + version_file = src_copy_path / "pyproject.toml" + if version_file.exists(): + content = tomli.loads(version_file.read_text()) + self.version = ( + content.get("tool", {}) + .get("bumpversion", {}) + .get("current_version") + ) + self.status.download_source = str(download_from) return self.status.download_source @@ -211,9 +230,7 @@ class SubPackage: branch = "" owner = "" dev_only: bool = False - - def __post_init__(self): - self.owner = self.subpackage_of + version: t.Optional[str] = None @dataclass