-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip(poly create with docs): create README and interface docstring whe…
…n creating a brick (#50) * wip(poly create with docs): create README and interface docstring when creating a brick * wip(poly create with docs): enable or disable the create README-on-poly-create feature * wip(poly create with docs): create readme handling an empty description * wip(poly create with docs): enable or disable the create README-on-poly-create feature * fix(workspace config): Brick README in a resources section * feat(poly create with docs): bump version to 1.2.0 * feat(poly create with docs): docs about the generate-README option and the new --description flag * feat(brick-docs): add info about the brick-docs feature in the plugin README
- Loading branch information
1 parent
a4e4624
commit c53667f
Showing
13 changed files
with
120 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,32 @@ | ||
from pathlib import Path | ||
from typing import Union | ||
|
||
from polylith.dirs import create_dir | ||
from polylith.files import create_file | ||
from polylith.interface import create_interface | ||
from polylith.readme import create_brick_readme | ||
from polylith.workspace import parser | ||
|
||
|
||
def create_brick( | ||
root: Path, brick: str, namespace: str, package: str, modulename: str = "core" | ||
root: Path, | ||
brick: str, | ||
namespace: str, | ||
package: str, | ||
description: Union[str, None], | ||
modulename: str = "core", | ||
) -> None: | ||
dirs_structure = parser.get_brick_structure_from_config(root) | ||
dirs = dirs_structure.format(brick=brick, namespace=namespace, package=package) | ||
d = create_dir(root, dirs) | ||
path_kwargs = {"brick": brick, "namespace": namespace, "package": package} | ||
|
||
brick_structure = parser.get_brick_structure_from_config(root) | ||
resources_structure = parser.get_resources_structure_from_config(root) | ||
|
||
brick_path = brick_structure.format(**path_kwargs) | ||
resources_path = resources_structure.format(**path_kwargs) | ||
|
||
d = create_dir(root, brick_path) | ||
create_file(d, f"{modulename}.py") | ||
create_interface(d, namespace, package, modulename) | ||
create_interface(d, namespace, package, modulename, description) | ||
|
||
if parser.is_readme_generation_enabled(root): | ||
create_brick_readme(root / resources_path, package, brick, description) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from polylith.readme.readme import create_workspace_readme | ||
from polylith.readme.readme import create_brick_readme, create_workspace_readme | ||
|
||
__all__ = ["create_workspace_readme"] | ||
__all__ = ["create_brick_readme", "create_workspace_readme"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters