parent
3891e7d58a
commit
96c3313ddf
3 changed files with 14 additions and 15 deletions
|
@ -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)
|
||||
|
||||
|
|
5
spcd/ci.py
Normal file
5
spcd/ci.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
from spcd.project import Project
|
||||
from spcd.projects import Projects
|
||||
|
||||
projects = Projects()
|
||||
project = Project(projects)
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue