Skip to content

Commit

Permalink
fix: Assembly behaviour correction and devops fixes.
Browse files Browse the repository at this point in the history
* Implemented trestle assemble with some UT

* Modified docs

* Code format

* Code lint

* Extending UT

* Full UT

* assemble bug fix

* fix 'make docs-serve' on linux (Red Hat 7.9)

Signed-off-by: Lou Degenaro <degenaro@us.ibm.com>

* Updated to deal with inherently plural model names.

Signed-off-by: Chris Butler <chris@thebutlers.me>

Co-authored-by: Nebula Alam <anebula@au1.ibm.com>
Co-authored-by: degenaro <degenaro@us.ibm.com>
  • Loading branch information
3 people authored Feb 2, 2021
1 parent 680be54 commit ac3828d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scripts/website_automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,5 @@ def md_txt(original: pathlib.Path, md_ed_license: pathlib.Path):
structer = create_module_markdowns(pathlib.Path('trestle'), 'trestle', pathlib.Path('docs/api_reference'))
update_mkdocs_meta(pathlib.Path('mkdocs.yml'), structer)
# Ensure single source of truth for license file
md_txt(pathlib.Path('license'), pathlib.Path('docs/license.md'))
md_txt(pathlib.Path('LICENSE'), pathlib.Path('docs/license.md'))
md_txt(pathlib.Path('DCO1.1.txt'), pathlib.Path('docs/contributing/DCO.md'))
2 changes: 1 addition & 1 deletion tests/trestle/core/commands/assemble_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_assemble_catalog(testdata_dir: pathlib.Path, tmp_trestle_dir: pathlib.P
assert rc == 0

# Read assembled model
actual_model = Catalog.oscal_read(pathlib.Path('dist/catalog.json'))
actual_model = Catalog.oscal_read(pathlib.Path('dist/catalogs/mycatalog.json'))
_, _, expected_model = load_distributed(mycatalog_dir / 'catalog.json')

assert actual_model == expected_model
Expand Down
5 changes: 4 additions & 1 deletion trestle/core/commands/assemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ def assemble_model(cls, model_alias: str, object_type: Type[TLO], args: argparse

# distributed load
_, _, assembled_model = load_distributed(root_model_filepath)
assembled_model_filepath = trestle_root / const.TRESTLE_DIST_DIR / f'{model_alias}.{args.extension}'
plural_alias = model_alias if model_alias[-1] == 's' else model_alias + 's'
assembled_model_dir = trestle_root / const.TRESTLE_DIST_DIR / plural_alias

assembled_model_filepath = assembled_model_dir / f'{args.name}.{args.extension}'

plan = Plan()
plan.add_action(CreatePathAction(assembled_model_filepath, True))
Expand Down

0 comments on commit ac3828d

Please sign in to comment.