Skip to content

Commit 6ad9312

Browse files
committed
create folders for output files if the folders don't exist, yet.
1 parent 2eb8842 commit 6ad9312

File tree

5 files changed

+8
-3
lines changed

5 files changed

+8
-3
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Install the package from source with pip:
9494
```bash
9595
cd mkdocs-encryptcontent-plugin/
9696
python setup.py sdist bdist_wheel
97-
pip install --force-reinstall --no-deps dist/mkdocs_encryptcontent_plugin-3.0.1-py3-none-any.whl
97+
pip install --force-reinstall --no-deps dist/mkdocs_encryptcontent_plugin-3.0.2-py3-none-any.whl
9898
```
9999

100100
Enable the plugin in your `mkdocs.yml`:

documentation/docs/installation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Install the package from source with pip:
1313
```bash
1414
cd mkdocs-encryptcontent-plugin/
1515
python setup.py sdist bdist_wheel
16-
pip install --force-reinstall --no-deps dist/mkdocs_encryptcontent_plugin-3.0.1-py3-none-any.whl
16+
pip install --force-reinstall --no-deps dist/mkdocs_encryptcontent_plugin-3.0.2-py3-none-any.whl
1717
```
1818

1919
Enable the plugin in your `mkdocs.yml`:

documentation/mkdocs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ plugins:
139139
webcrypto: true
140140
sign_files: 'encryptcontent-plugin.json'
141141
cache_file: 'encryptcontent.cache'
142+
sharelinks_output: 'sharelinks.txt'
142143
hash_filenames:
143144
extensions:
144145
- 'png'

encryptcontent/plugin.py

+4
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ def on_config(self, config, **kwargs):
541541
# rebuild kdf keys only if not in cache
542542
if 'cache_file' not in self.setup and self.config['cache_file']:
543543
self.setup['cache_file'] = self.setup['config_path'].joinpath(self.config['cache_file'])
544+
self.setup['cache_file'].parents[0].mkdir(parents=True, exist_ok=True)
544545
if self.setup['cache_file'].exists():
545546
with open(self.setup['cache_file'], 'r') as stream:
546547
self.setup['cache'] = yaml.safe_load(stream)
@@ -557,6 +558,7 @@ def on_config(self, config, **kwargs):
557558

558559
if 'sharelinks' not in self.setup and self.config['sharelinks']:
559560
self.setup['sharelinks_output'] = self.setup['config_path'].joinpath(self.config['sharelinks_output'])
561+
self.setup['sharelinks_output'].parents[0].mkdir(parents=True, exist_ok=True)
560562
self.setup['sharelinks'] = {}
561563

562564
if 'password_inventory' not in self.setup:
@@ -612,6 +614,7 @@ def on_config(self, config, **kwargs):
612614

613615
if self.config['sign_files'] and 'sign_key' not in self.setup:
614616
sign_key_path = self.setup['config_path'].joinpath(self.config['sign_key'])
617+
sign_key_path.parents[0].mkdir(parents=True, exist_ok=True)
615618
if not sign_key_path.exists():
616619
logger.info('Generating signing key and saving to "{file}".'.format(file=str(self.config['sign_key'])))
617620
key = ECC.generate(curve='Ed25519')
@@ -1133,6 +1136,7 @@ def on_post_build(self, config, **kwargs):
11331136
urls_to_verify.append(file['url'])
11341137
if signatures:
11351138
sign_file_path = Path(config.data["site_dir"]).joinpath(self.config['sign_files'])
1139+
sign_file_path.parents[0].mkdir(parents=True, exist_ok=True)
11361140
with open(sign_file_path, "w") as file:
11371141
file.write(json.dumps(signatures))
11381142

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def read(fname):
1111

1212
setup(
1313
name='mkdocs-encryptcontent-plugin',
14-
version='3.0.1',
14+
version='3.0.2',
1515
author='unverbuggt',
1616
author_email='unverbuggt@xn--rthlein-n2a.de',
1717
description='A MkDocs plugin that encrypt/decrypt markdown content with AES',

0 commit comments

Comments
 (0)