WIP: dev into master #184

Draft
edraft wants to merge 121 commits from dev into master
Showing only changes of commit e3b19c9984 - Show all commits

View File

@@ -84,7 +84,7 @@ class Structure:
return Project.from_file(path) return Project.from_file(path)
workspace = Structure.find_workspace_in_path(path.parent) workspace = Structure.find_workspace_in_path(path.parent, with_parents=True)
if workspace is None: if workspace is None:
raise RuntimeError("No workspace found. Please run 'cpl init workspace' first.") raise RuntimeError("No workspace found. Please run 'cpl init workspace' first.")
@@ -138,6 +138,16 @@ class Structure:
) )
project.save() project.save()
Console.write_line(f"Created {project_type} project '{name}'")
if workspace is not None:
rel_path = str(path.resolve().absolute().relative_to(Path(workspace.path).parent)).replace("\\", "/")
if rel_path not in workspace.projects:
workspace.projects.append(rel_path)
workspace.save()
if verbose:
Console.write_line(f"Registered '{name}' in workspace.json")
from cpl.cli.command.package.install import install from cpl.cli.command.package.install import install
@@ -149,17 +159,6 @@ class Structure:
install.callback(package, project.name, dev=False, verbose=verbose) install.callback(package, project.name, dev=False, verbose=verbose)
os.chdir(old_cwd) os.chdir(old_cwd)
if workspace is not None:
rel_path = str(path.resolve().absolute().relative_to(Path(workspace.path).parent)).replace("\\", "/")
if rel_path not in workspace.projects:
workspace.projects.append(rel_path)
workspace.save()
if verbose:
Console.write_line(f"Registered '{name}' in workspace.json")
Console.write_line(f"Created {project_type} project '{name}'")
return project return project
@staticmethod @staticmethod