Skip to content

Commit 3ec9561

Browse files
committed
Add path exlusion to fetch command
1 parent 55efc92 commit 3ec9561

File tree

3 files changed

+56
-7
lines changed

3 files changed

+56
-7
lines changed

.github/workflows/docs-ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ jobs:
5555
- name: "Build Docs"
5656
working-directory: "pulp-docs"
5757
run: |
58-
pulp-docs fetch --dest /tmp/pulp-docs-tmp
59-
pulp-docs build --path pulp-docs@..:${{ github.event.repository.name }}@..:/tmp/pulp-docs-tmp
58+
PATH="pulp-docs@..:${{ github.event.repository.name }}@.."
59+
TMPDIR="/tmp/pulp-docs-tmp"
60+
pulp-docs fetch --path "$PATH" --dest "$TMPDIR"
61+
pulp-docs build --path "$PATH:$TMPDIR"
6062
6163
- name: "Sanity Check"
6264
working-directory: "pulp-docs"

.yamllint.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
3+
yaml-files:
4+
- '*.yaml'
5+
- '*.yml'
6+
- '.yamllint'
7+
8+
rules: # defaults are commented out
9+
# anchors: enable
10+
# braces: enable
11+
# brackets: enable
12+
# colons: enable
13+
# commas: enable
14+
# comments:
15+
# level: warning
16+
# comments-indentation:
17+
# level: warning
18+
document-end: enable
19+
document-start: enable
20+
# level: warning
21+
# empty-lines: enable
22+
# empty-values: disable
23+
# float-values: disable
24+
# hyphens: enable
25+
# indentation: enable
26+
# key-duplicates: enable
27+
# key-ordering: disable
28+
# line-length: enable
29+
# new-line-at-end-of-file: enable
30+
# new-lines: enable
31+
# octal-values: disable
32+
# https://yamllint.readthedocs.io/en/stable/rules.html#module-yamllint.rules.quoted_strings
33+
quoted-strings:
34+
quote-type: double
35+
required: true
36+
allow-quoted-quotes: true
37+
check-keys: false
38+
39+
# trailing-spaces: enable
40+
# truthy:
41+
# level: warning
42+
...

src/pulp_docs/cli.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from mkdocs.__main__ import cli as mkdocs_cli
77
from mkdocs.config import load_config
88
from pulp_docs.context import ctx_blog, ctx_docstrings, ctx_draft, ctx_path
9+
from pulp_docs.plugin import load_components
910

1011

1112
def blog_callback(ctx: click.Context, param: click.Parameter, value: bool) -> bool:
@@ -63,7 +64,7 @@ def find_path_callback(ctx: click.Context, param: click.Parameter, value: bool)
6364
)
6465

6566

66-
async def clone_repositories(repositories: list[str], dest_dir: Path) -> None:
67+
async def clone_repositories(repositories: set[str], dest_dir: Path) -> None:
6768
"""Clone multiple repositories concurrently."""
6869

6970
async def clone_repository(repo_url: str) -> None:
@@ -100,16 +101,20 @@ async def clone_repository(repo_url: str) -> None:
100101
envvar="PULPDOCS_DIR",
101102
help="Path to mkdocs.yml config file",
102103
)
103-
def fetch(dest, config_file):
104+
@path_option
105+
def fetch(dest, config_file, find_path):
104106
"""Fetch repositories to destination dir."""
105107
dest_path = Path(dest)
106108
config = load_config(config_file)
107-
components = config.plugins["PulpDocs"].config.components
108-
repositories_list = list({r.git_url for r in components})
109+
all_components = config.plugins["PulpDocs"].config.components
110+
all_repositories_set = {r.git_url for r in all_components if r.git_url}
111+
found_components = load_components(find_path, config_file, draft=True)
112+
found_repositories_set = {r.git_url for r in found_components}
113+
final_repositories_set = all_repositories_set - found_repositories_set
109114

110115
if not dest_path.exists():
111116
dest_path.mkdir(parents=True)
112-
asyncio.run(clone_repositories(repositories_list, dest_path))
117+
asyncio.run(clone_repositories(final_repositories_set, dest_path))
113118

114119

115120
main = mkdocs_cli

0 commit comments

Comments
 (0)