Skip to content

Commit

Permalink
Fix edit urls, add new keep_docs_dir config param, and pre-commit (#75
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jdoiro3 authored Jan 23, 2023
1 parent 2419b8e commit d2e7bdb
Show file tree
Hide file tree
Showing 27 changed files with 493 additions and 270 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ on:
- main
paths-ignore:
- '**/README.md'


# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
version_check:
name: Check pyproject.toml version
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ on:
- main
paths:
- "pyproject.toml"


# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
generate-gh-release:
type: choice
description: Generate a GH release and create a new tag
default: 'false'
options:
default: 'false'
options:
- 'true'
- 'false'
run-integration-tests:
type: choice
description: Run integration testing before generating release
default: 'true'
options:
default: 'true'
options:
- 'true'
- 'false'

jobs:
unit-tests:
name: Unit Tests
Expand Down Expand Up @@ -176,4 +176,3 @@ jobs:
${{ fromJSON(steps.get-changes.outputs.result).changes }}
draft: false
prerelease: false

3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main
paths-ignore:
- '**/README.md'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand Down Expand Up @@ -76,4 +76,3 @@ jobs:
pip install -r integration-requirements.txt
- name: Integration Tests
run: ./__tests__/test-bats-ci.sh

34 changes: 34 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
repos:
- repo: https://github.com/timothycrosley/isort
rev: 5.10.1
hooks:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
language_version: python3.10.2
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-case-conflict
- id: mixed-line-ending
- id: check-added-large-files
- id: check-ast
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- repo: https://github.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
args: ["--select=E9,F63,F7,F82", "--show-source", "--max-complexity=10", "--max-line-length=127", "--statistics"]
- repo: local
hooks:
- id: unit-tests
name: run unit tests
entry: python -m unittest tests.unittests
language: system
pass_filenames: false
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
## 0.5.0

### PRs in Release

- [Create .git/info dir if it does not exist](https://github.com/jdoiro3/mkdocs-multirepo-plugin/pull/59)
- [Fix edit urls and add new `keep_docs_dir` config param](https://github.com/jdoiro3/mkdocs-multirepo-plugin/pull/75)

### Added Features

A new `keep_docs_dir` was added to the `multirepo` config. Setting this to `true` will cause the plugin to not move the contents of the `docs_dir` up and delete it. See issue [#74](https://github.com/jdoiro3/mkdocs-multirepo-plugin/issues/74) for more details.

#### Usage Example

```yaml
plugins:
- search
- multirepo:
keep_docs_dir: true
```
## 0.4.12
- Fixed use of `GithubAccessToken` environment variable so that the sparse clone now uses the correct token.
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ If you like this plugin and want me to continue maintaining it in my free time,
## Dependencies

![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54)
![Git](https://img.shields.io/badge/git-%23F05033.svg?style=for-the-badge&logo=git&logoColor=white)
![Git](https://img.shields.io/badge/git-%23F05033.svg?style=for-the-badge&logo=git&logoColor=white)

> Newer versions of Git preferred.
Expand All @@ -51,13 +51,14 @@ plugins:
The plugin introduces the *!import* statement in your config's *nav* section. You can now use the import statement to add a documentation section, where the docs are pulled from the source repo.
<details><summary><b>!import Statement Sections</b></summary>
- **{url}**: Only *required* part of *!import* statement (e.g., `https://github.com/{user}/{repo name}`).
- **branch={branch}**: Tells *multirepo* what branch (or tag) to use. Defaults to *master* if not supplied. This is the same argument used in `git clone` (see [here](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---branchltnamegt)).
- **docs_dir={path}**: The path to the *docs* directory for the section. Defaults to *docs/\** (a glob) if not supplied.
- **multi_docs={True | False}**: If set to *True*, all *docs* directories will be imported (more info [here](#α-multiple-docs-directories-in-imported-repo-alpha)).
- **multi_docs={True | False}**: If set to *True* all *docs* directories will be imported (more info [here](#α-multiple-docs-directories-in-imported-repo-alpha)).
- **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 to *True* the docs directory will not be removed when importing docs. When using this with a `nav` section in an *imported* repo you must keep the docs directory in the path (e.g., `docs/path/to/file.md`).

</details>

Expand Down Expand Up @@ -157,7 +158,7 @@ By default, this directory turns into this.
│ index.md
```
> Note:
> Note:
> - If using the nav *!import* statement, make sure the nav paths reflect the new directory structure, which doesn't include *docs* directories.
> - *edit_urls* will still map to underlying markdown file based on the actual directory structure in the remote's repository.
Expand Down Expand Up @@ -249,4 +250,3 @@ $ PYTHON_37_ONLY=1 ./__tests__/test.sh
```
$ python[3] -m unittest tests.unittests
```
2 changes: 1 addition & 1 deletion __tests__/fixtures/error-no-docs-folder/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ edit_uri: /blob/master/
nav:
- Home: index.md
- Page1: page1.md
- Page2: page2.md
- Page2: page2.md
2 changes: 1 addition & 1 deletion __tests__/fixtures/error-no-nav/docs/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
edit_uri: /blob/master/
edit_uri: /blob/master/
2 changes: 1 addition & 1 deletion __tests__/fixtures/parent-config-test/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ nav:
- section: '!import https://github.com/jdoiro3/mkdocs-multirepo-demoRepo1?branch=ok-with-diff-config-nm-and-loc&config=multirepo.yml'

plugins:
- multirepo
- multirepo
2 changes: 1 addition & 1 deletion __tests__/fixtures/parent-confirm-no-mkdocs.yml/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ nav:
- DemoRepo: '!import https://github.com/jdoiro3/mkdocs-multirepo-demoRepo1?branch=test-config-in-root'

plugins:
- multirepo
- multirepo
2 changes: 1 addition & 1 deletion __tests__/fixtures/parent-multiple-nav-imports/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ nav:
- ok-nav-simple: '!import https://github.com/jdoiro3/mkdocs-multirepo-demoRepo1?branch=ok-nav-simple'

plugins:
- multirepo
- multirepo
2 changes: 0 additions & 2 deletions __tests__/fixtures/parent-with-imported-images/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ nav:

plugins:
- multirepo


2 changes: 1 addition & 1 deletion __tests__/fixtures/parent-with-indexes-nav/docs/about.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
About page
About page
2 changes: 1 addition & 1 deletion __tests__/fixtures/parent-with-indexes-nav/docs/index.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
index page
index page
4 changes: 1 addition & 3 deletions __tests__/fixtures/parent-with-indexes-nav/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ theme:
nav:
- Home:
- index.md
- About: about.md
- About: about.md
- ok-nav-simple: '!import https://github.com/jdoiro3/mkdocs-multirepo-demoRepo1?branch=ok-nav-simple'

plugins:
- multirepo


2 changes: 0 additions & 2 deletions __tests__/fixtures/parent-with-nav/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ nav:

plugins:
- multirepo


2 changes: 1 addition & 1 deletion __tests__/fixtures/parent-with-repos/docs/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Hello World

Main page of parent repo.
Main page of parent repo.
2 changes: 1 addition & 1 deletion __tests__/setup-bats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
sudo add-apt-repository ppa:duggan/bats
sudo apt-get update
sudo apt-get install bats
sudo apt-get install git
sudo apt-get install git
2 changes: 1 addition & 1 deletion __tests__/test-bats-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ elif [[ -f "$LOCAL_E2E_PATH" ]]; then
else
echo "Could not find the test.bats file. Please check /__tests__/test-ci.sh and correct the paths."
exit 1
fi
fi
2 changes: 1 addition & 1 deletion __tests__/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ debugger() {

outputContains() {
if [[ "$output" == *"$1"* ]]
then
then
return 0
else
echo "Output does not contain '$1'"
Expand Down
2 changes: 1 addition & 1 deletion __tests__/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ else
docker_run_integration_tests "3-slim"
docker_run_integration_tests "3.6-slim"
docker_run_integration_tests "3.7-slim"
fi
fi
Loading

0 comments on commit d2e7bdb

Please sign in to comment.