Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
jdoiro3 authored May 31, 2024
2 parents 0bd836c + 3ce1085 commit 7483663
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
echo "run-integration-tests = ${{ github.event.inputs.run-integration-tests }}"
echo "generate-gh-release = ${{ github.event.inputs.generate-gh-release }}"
echo "release-to-pypi-override = ${{ github.event.inputs.elease-to-pypi-override }}"
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
Expand Down
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
## 0.6.4
## 0.7.1

### prs in Release
### Prs in Release

- [Support edit_url starting with http](https://github.com/jdoiro3/mkdocs-multirepo-plugin/pull/120)

## 0.7.0

### Prs in Release

- [Fix section case](https://github.com/jdoiro3/mkdocs-multirepo-plugin/pull/124)
- [Remove deprecation warning](https://github.com/jdoiro3/mkdocs-multirepo-plugin/pull/131)

## 0.6.3

### Prs in Release

- [Only exclude mkdocs config YAML files.](https://github.com/jdoiro3/mkdocs-multirepo-plugin/pull/117)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ The plugin introduces the *!import* statement in your config's *nav* section. Yo
- **config={filename}.yml**: Tells *multirepo* the name of the config file, containing configuration for the plugin. The default value is also `mkdocs.yml`. This config file can live within the docs directory *or* in the parent directory.
- **extra_imports=["{filename | path | glob}"]**: Use this if you want to import additional directories or files along with the docs.
- **keep_docs_dir={True | False}**: If set the docs directory will not be removed when importing docs (i.e., `section/page.md` becomes `section/docs/page.md`)

</details>

```yaml
Expand Down
6 changes: 4 additions & 2 deletions mkdocs_multirepo_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def handle_repos_import(self, config: Config, repos: List[RepoConfig]) -> Config
raise ImportSyntaxError(
"import_url should only contain the url with plugin accepted params. You included '!import'."
)
section_slug = slugify(repo.section)
section_slug = slugify(text=repo.section, lowercase=False)
path = repo.section_path
repo_name = f"{path}/{section_slug}" if path is not None else section_slug
# mkdocs config values edit_uri and repo_url aren't set
Expand Down Expand Up @@ -324,7 +324,9 @@ def on_files(self, files: Files, config: Config) -> Files:
repo_config_path = repo.config_path
for f in repo_files:
if f.src_path == repo_config_path:
log.info(f"Multirepo plugin is not copying config file: {f.src_path}")
log.info(
f"Multirepo plugin is not copying config file: {f.src_path}"
)
else:
# the file needs to know about the repo it belongs to
f.repo = repo
Expand Down
Empty file modified mkdocs_multirepo_plugin/scripts/mv_docs_up.sh
100644 → 100755
Empty file.
Empty file modified mkdocs_multirepo_plugin/scripts/sparse_clone_old.sh
100644 → 100755
Empty file.
11 changes: 1 addition & 10 deletions mkdocs_multirepo_plugin/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from typing import Callable, Dict, List, Optional, Tuple, Union

from mkdocs.config import Config
from mkdocs.structure.files import File, Files, _filter_paths, _sort_files
from mkdocs.structure.files import File, Files, _sort_files
from mkdocs.utils import yaml_load
from slugify import slugify

Expand Down Expand Up @@ -436,25 +436,16 @@ async def batch_import(
def get_files(config: Config, repo: DocsRepo) -> Files:
"""Walk the `docs_dir` and return a Files collection."""
files = []
exclude = [".*", "/templates"]

for source_dir, dirnames, filenames in os.walk(repo.location, followlinks=True):
relative_dir = os.path.relpath(source_dir, repo.temp_dir)

for dirname in list(dirnames):
path = os.path.normpath(os.path.join(relative_dir, dirname))
# Skip any excluded directories
if _filter_paths(basename=dirname, path=path, is_dir=True, exclude=exclude):
dirnames.remove(dirname)
dirnames.sort()

for filename in _sort_files(filenames):
path = os.path.normpath(os.path.join(relative_dir, filename))
# Skip any excluded files
if _filter_paths(
basename=filename, path=path, is_dir=False, exclude=exclude
):
continue
# Skip README.md if an index file also exists in dir
if filename == "README.md" and "index.md" in filenames:
log.warning(
Expand Down
4 changes: 1 addition & 3 deletions mkdocs_multirepo_plugin/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@
from sys import platform, version_info
from typing import Any, Dict

from mkdocs.utils import warning_filter

# used for getting Git version
GitVersion = namedtuple("GitVersion", "major minor")
LINUX_LIKE_PLATFORMS = ["linux", "linux2", "darwin"]

# This is a global variable imported by other modules
log = logging.getLogger("mkdocs.plugins." + __name__)
log.addFilter(warning_filter)


class ImportDocsException(Exception):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mkdocs-multirepo-plugin"
version = "0.6.4"
version = "0.7.0"
description = "Build documentation in multiple repos into one site."
authors = ["jdoiro3 <[email protected]>"]
license = "MIT"
Expand Down
24 changes: 14 additions & 10 deletions tests/unittests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import unittest
from pathlib import Path
from shutil import copy
from parameterized import parameterized

from aiofiles import tempfile
from parameterized import parameterized

from mkdocs_multirepo_plugin import structure, util

Expand Down Expand Up @@ -389,15 +389,19 @@ async def test_extra_imports(self):
for file in expected_files + expected_src_files:
self.assertFileExists(file)

@parameterized.expand([
(True, False, True), # keep_docs_dir is set, global setting ignored
(True, True, True),
(False, False, False),
(False, True, False),
(None, False, False), # keep_docs_dir is not set, global setting overrides
(None, True, True),
])
async def test_keep_docs_dir(self, keep_docs_dir, global_keep_docs_dir, expected_docs_exist):
@parameterized.expand(
[
(True, False, True), # keep_docs_dir is set, global setting ignored
(True, True, True),
(False, False, False),
(False, True, False),
(None, False, False), # keep_docs_dir is not set, global setting overrides
(None, True, True),
]
)
async def test_keep_docs_dir(
self, keep_docs_dir, global_keep_docs_dir, expected_docs_exist
):
async with tempfile.TemporaryDirectory() as temp_dir:
temp_dir_path = pathlib.Path(temp_dir)
docsRepo = structure.DocsRepo(
Expand Down

0 comments on commit 7483663

Please sign in to comment.