Hotfix:deploy

This commit is contained in:
Maximilien Rigaut 2022-06-15 20:53:45 +02:00
parent 53455e8ec2
commit 5c104b155f
No known key found for this signature in database
GPG Key ID: 4F14B23709ADA5B1
6 changed files with 25 additions and 13 deletions

3
.gitignore vendored
View File

@ -156,4 +156,5 @@ cython_debug/
example_userfiles/output/
example_userfiles/output/*
dev_outputs/*
/example_output/*
example_output/*
dics/*

View File

@ -6,10 +6,11 @@ bootstraparse aims to be customisable in that regard, but its first iteration an
You can refer to the `example_userfiles` for an idea of what the parser expects you to feed it and find an example of our automated generation at https://idle-org.github.io/bootstraparse/ for this particular folder. Or you can run the program yourself for the same result!
- Main
- [![Python Main](https://github.com/idle-org/bootstraparse/actions/workflows/python-app.yml/badge.svg?branch=main)](https://github.com/idle-org/bootstraparse/actions/workflows/python-app.yml)
- [![Python Tests and Lint](https://github.com/idle-org/bootstraparse/actions/workflows/python-tests.yml/badge.svg?branch=main)](https://github.com/idle-org/bootstraparse/actions/workflows/python-tests.yml)
- Releases
- [![Python Release](https://github.com/idle-org/bootstraparse/actions/workflows/python-app.yml/badge.svg?branch=release)](https://github.com/idle-org/bootstraparse/actions/workflows/python-app.yml)
- [![Python Tests and Lint](https://github.com/idle-org/bootstraparse/actions/workflows/python-tests.yml/badge.svg?branch=develop)](https://github.com/idle-org/bootstraparse/actions/workflows/python-tests.yml)
- Deploy
- [![Python Deployment](https://github.com/idle-org/bootstraparse/actions/workflows/python-deploy.yml/badge.svg)](https://github.com/idle-org/bootstraparse/actions/workflows/python-deploy.yml)
---
## Release Notes
### V1.0.1

View File

@ -2,7 +2,7 @@
# Main program, use this to start parsing
from bootstraparse.modules import sitecreator
from bootstraparse.modules import sitecreator, error_mngr
import argparse
import sys
@ -21,5 +21,6 @@ def parse(_args):
if __name__ == "__main__": # pragma: no cover
args = parse(sys.argv[1:])
error_mngr.init_logging(filename=None, loglevel="DEBUG", filemode='w', handler=None)
if sitecreator.create_website(args.origin, args.destination) == 0:
print("Bootstraparse run successful!")

View File

@ -21,4 +21,4 @@ export:
intermediate_files: true
type: "html"
force_rewrite: true
copy_unparsable_files: "copy" # "copy" or "ignore"
copy_unparsable_files: copy

View File

@ -74,11 +74,16 @@ class ConfigLoader:
if name not in self.loaded_conf:
self.loaded_conf[name] = yaml.safe_load(f)
else:
self.loaded_conf[name].update(yaml.safe_load(f))
error_mngr.log_message(f"Warning: {name} is already in {self.loaded_conf}", level='INFO')
new_config = yaml.safe_load(f)
for key in new_config:
if key in self.loaded_conf[name]:
self.loaded_conf[name][key].update(new_config[key])
else:
self.loaded_conf[name][key] = new_config[key]
error_mngr.log_message(f"Warning: {name} is already in {self.loaded_conf}", level='CRITICAL')
except BaseException as e:
error_mngr.log_message(f'Error parsing in file {basename} at {filepath}.', level='CRITICAL')
error_mngr.log_exception(str(e), level='CRITICAL')
error_mngr.log_exception(e, level='CRITICAL')
def load_from_folder(self, folder):
"""

View File

@ -1,5 +1,7 @@
import os
from yaml.scanner import ScannerError
import bootstraparse.modules.config as config
import pytest
import tempfile
@ -10,7 +12,8 @@ configs = {
"app/configs/parser_config.yaml": '{"parser": {"name": "test_parser", "type": "test_parser"}}',
"app/configs/aliases.yaml": '{"parser": {"name": "test_parser", "type": "test_parser"}}',
"user/config/aliases.yaml": '{"aliases": {"test_alias": "test_parser"}}',
"user/config/glossary.yaml": '{"glossary": {"test_glossary": "test_parser"}}',
"app/configs/glossary.yaml": '{"glossary": {"test_glossary": "test_parser"}}',
"user/config/glossary.yaml": '{"glossary": {"test_glossary": "second_parser"}}',
"user/config/custom_template.yaml": '{"custom_template": {"test_template": "test_parser"}}',
}
bad_configs = {
@ -36,7 +39,9 @@ def make_false_configs():
def test_config_load():
usr_c = config.ConfigLoader(user_conf)
assert usr_c["aliases"] == {"aliases": {"test_alias": "test_parser"}}
assert usr_c["glossary"] == {"glossary": {"test_glossary": "test_parser"}}
assert usr_c["glossary"] == {"glossary": {"test_glossary": "second_parser"}}
assert usr_c["glossary"]["glossary"] == {"test_glossary": "second_parser"}
assert usr_c["glossary"]["glossary"]["test_glossary"] == "second_parser"
assert usr_c["aliases"]["aliases"] == {"test_alias": "test_parser"}
assert usr_c["aliases"]["aliases"]["test_alias"] == "test_parser"
with pytest.raises(KeyError):
@ -54,7 +59,6 @@ def test_add_to_config():
assert from_list["aliases"] == {"aliases": {"test_alias": "test_parser"},
"parser": {"name": "test_parser", "type": "test_parser"}}
assert from_list["parser_config"] == {"parser": {"name": "test_parser", "type": "test_parser"}}
with pytest.raises(KeyError): # Not FileNotFoundError
assert from_empty["aliases"]
from_empty.add_folder(user_conf)
@ -64,7 +68,7 @@ def test_add_to_config():
assert from_empty["aliases"] == {"aliases": {"test_alias": "test_parser"},
"parser": {"name": "test_parser", "type": "test_parser"}}
with pytest.raises(TypeError):
with pytest.raises(ScannerError):
from_empty.load_from_file(os.path.join(bad_conf, "bad_config.yaml"))