clone_project_branch
This commit is contained in:
parent
ff8a371253
commit
e200ff583b
2 changed files with 27 additions and 25 deletions
|
@ -9,13 +9,34 @@ from rwx import fs
|
||||||
from rwx.log import stream as log
|
from rwx.log import stream as log
|
||||||
from rwx.ps import run
|
from rwx.ps import run
|
||||||
|
|
||||||
import spcd
|
|
||||||
from spcd import cmd
|
from spcd import cmd
|
||||||
from spcd.util import browse, cat, step
|
from spcd.ci import project, projects
|
||||||
|
from spcd.util import browse, cat, split, step
|
||||||
|
|
||||||
COMMANDS_PREFIX = "spcd-"
|
COMMANDS_PREFIX = "spcd-"
|
||||||
|
|
||||||
|
|
||||||
|
def clone_project_branch() -> None:
|
||||||
|
step("Clone project branch")
|
||||||
|
log.info(projects)
|
||||||
|
split()
|
||||||
|
log.info(project)
|
||||||
|
split()
|
||||||
|
log.info(f"""\
|
||||||
|
{project.url}
|
||||||
|
↓
|
||||||
|
""")
|
||||||
|
run(
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--branch",
|
||||||
|
project.branch,
|
||||||
|
"--",
|
||||||
|
project.url,
|
||||||
|
project.root,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def install_commands(path: str) -> None:
|
def install_commands(path: str) -> None:
|
||||||
step("Install commands")
|
step("Install commands")
|
||||||
user = Path("/usr/local/bin")
|
user = Path("/usr/local/bin")
|
||||||
|
@ -34,8 +55,9 @@ def main(main: str) -> None:
|
||||||
path, *arguments = sys.argv
|
path, *arguments = sys.argv
|
||||||
name = Path(path).name
|
name = Path(path).name
|
||||||
if name == "__main__.py":
|
if name == "__main__.py":
|
||||||
spcd.set_ssh(*arguments)
|
clone_project_branch()
|
||||||
spcd.install_commands(main)
|
set_ssh(*arguments)
|
||||||
|
install_commands(main)
|
||||||
else:
|
else:
|
||||||
function = getattr(cmd, name.replace("-", "_"))
|
function = getattr(cmd, name.replace("-", "_"))
|
||||||
function(*arguments)
|
function(*arguments)
|
||||||
|
|
22
spcd/cmd.py
22
spcd/cmd.py
|
@ -6,7 +6,7 @@ from rwx import ps
|
||||||
from rwx.log import stream as log
|
from rwx.log import stream as log
|
||||||
|
|
||||||
from spcd.ci import project, projects
|
from spcd.ci import project, projects
|
||||||
from spcd.util import browse, split
|
from spcd.util import browse
|
||||||
|
|
||||||
|
|
||||||
def spcd_browse_workspace() -> None:
|
def spcd_browse_workspace() -> None:
|
||||||
|
@ -23,26 +23,6 @@ def spcd_build_project() -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def spcd_clone_branch() -> None:
|
|
||||||
log.info(projects)
|
|
||||||
split()
|
|
||||||
log.info(project)
|
|
||||||
split()
|
|
||||||
log.info(f"""\
|
|
||||||
{project.url}
|
|
||||||
↓
|
|
||||||
""")
|
|
||||||
ps.run(
|
|
||||||
"git",
|
|
||||||
"clone",
|
|
||||||
"--branch",
|
|
||||||
project.branch,
|
|
||||||
"--",
|
|
||||||
project.url,
|
|
||||||
project.root,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def spcd_list_environment() -> None:
|
def spcd_list_environment() -> None:
|
||||||
for variable, value in sorted(projects.environment.items()):
|
for variable, value in sorted(projects.environment.items()):
|
||||||
log.info(f"{variable} = {value}")
|
log.info(f"{variable} = {value}")
|
||||||
|
|
Loading…
Reference in a new issue