From 96c3313ddf157479df27a3d81717195b92184b9c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 Jul 2024 00:46:07 +0200 Subject: [PATCH] ci --- spcd/__init__.py | 19 +++++++------------ spcd/ci.py | 5 +++++ spcd/cmd.py | 5 ++--- 3 files changed, 14 insertions(+), 15 deletions(-) create mode 100644 spcd/ci.py diff --git a/spcd/__init__.py b/spcd/__init__.py index 3a7c546..51f53b2 100644 --- a/spcd/__init__.py +++ b/spcd/__init__.py @@ -12,14 +12,9 @@ from rwx.log import stream as log import spcd from spcd import cmd -from spcd.project import Project -from spcd.projects import Projects COMMANDS_PREFIX = "spcd-" -projects = Projects() -project = Project(projects) - def browse(root: str) -> None: paths = [] @@ -67,27 +62,27 @@ def main(main: str) -> None: def set_ssh(*arguments: list[str]) -> None: step("Set SSH") - # + # get variables ssh_key, ssh_hosts = arguments - # + # set key type ssh_type = "ed25519" - # + # set home directory home = Path("~").expanduser() - # + # make home directory ssh = home / ".ssh" ssh.mkdir(exist_ok=True, parents=True) ssh.chmod(0o700) - # + # write private key key = ssh / f"id_{ssh_type}" if ssh_key: fs.write(key, ssh_key) key.chmod(0o400) - # + # write known hosts known = ssh / "known_hosts" if ssh_hosts: fs.write(known, ssh_hosts) known.chmod(0o400) - # + # display browse(ssh) cat(known) diff --git a/spcd/ci.py b/spcd/ci.py new file mode 100644 index 0000000..4e22f01 --- /dev/null +++ b/spcd/ci.py @@ -0,0 +1,5 @@ +from spcd.project import Project +from spcd.projects import Projects + +projects = Projects() +project = Project(projects) diff --git a/spcd/cmd.py b/spcd/cmd.py index 24f6458..99c3268 100644 --- a/spcd/cmd.py +++ b/spcd/cmd.py @@ -1,10 +1,11 @@ import os from pathlib import Path +from ci import project, projects from rwx import ps from rwx.log import stream as log -from spcd import browse, project, projects, split +from spcd import browse, split def spcd_browse_workspace() -> None: @@ -50,9 +51,7 @@ def spcd_synchronize() -> None: host = "rwx.work" source = "out" user = "cd" - # root = Path(os.sep) / user / project.branch / projects.group / project.name - # target = f"{user}@{host}:{root}" ps.run( "rsync",