Compare commits
No commits in common. "b3f4cffbca88c4430c5a780577a6b936f5c3c9e2" and "ae015fdfc4fc00cce64b5cb760553f944ab44a94" have entirely different histories.
b3f4cffbca
...
ae015fdfc4
5 changed files with 33 additions and 40 deletions
|
@ -33,7 +33,6 @@ path = "spcd/__init__.py"
|
||||||
|
|
||||||
[tool.pydoclint]
|
[tool.pydoclint]
|
||||||
allow-init-docstring = true
|
allow-init-docstring = true
|
||||||
quiet = true
|
|
||||||
skip-checking-short-docstrings = false
|
skip-checking-short-docstrings = false
|
||||||
style = "sphinx"
|
style = "sphinx"
|
||||||
|
|
||||||
|
|
|
@ -26,13 +26,10 @@ def clone_project_branch() -> None:
|
||||||
split()
|
split()
|
||||||
log.info(project)
|
log.info(project)
|
||||||
split()
|
split()
|
||||||
log.info(
|
log.info("""\
|
||||||
"""\
|
|
||||||
%s
|
%s
|
||||||
↓
|
↓
|
||||||
""",
|
""", project.url)
|
||||||
project.url,
|
|
||||||
)
|
|
||||||
run(
|
run(
|
||||||
"git",
|
"git",
|
||||||
"clone",
|
"clone",
|
||||||
|
|
|
@ -44,3 +44,16 @@ class Project:
|
||||||
self.root = Path(value)
|
self.root = Path(value)
|
||||||
# url
|
# url
|
||||||
self.url = add_url_path(projects.url, self.name)
|
self.url = add_url_path(projects.url, self.name)
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
"""Represent project."""
|
||||||
|
return f"Project(projects={self.projects!r})"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
"""List branch, name, root & url."""
|
||||||
|
return f"""\
|
||||||
|
branch = {self.branch}
|
||||||
|
name = {self.name}
|
||||||
|
root = {self.root}
|
||||||
|
url = {self.url}
|
||||||
|
"""
|
||||||
|
|
|
@ -33,3 +33,15 @@ class Projects:
|
||||||
for variable in SERVER_URL:
|
for variable in SERVER_URL:
|
||||||
if value := self.environment.get(variable, None):
|
if value := self.environment.get(variable, None):
|
||||||
self.url = add_url_path(value, self.group)
|
self.url = add_url_path(value, self.group)
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
"""Represent projects."""
|
||||||
|
return "Projects()"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
"""List group, name & url."""
|
||||||
|
return f"""\
|
||||||
|
group = {self.group}
|
||||||
|
name = {self.name}
|
||||||
|
url = {self.url}
|
||||||
|
"""
|
||||||
|
|
40
spcd/util.py
40
spcd/util.py
|
@ -12,26 +12,14 @@ from spcd.shell import env
|
||||||
|
|
||||||
|
|
||||||
def add_url_path(url: str, extra_path: str) -> str:
|
def add_url_path(url: str, extra_path: str) -> str:
|
||||||
"""Append an extra segment to an existing URL.
|
"""Append an extra segment to an existing URL."""
|
||||||
|
|
||||||
:param url: base URL
|
|
||||||
:type url: str
|
|
||||||
:param extra_path: path to append
|
|
||||||
:type extra_path: str
|
|
||||||
:return: new URL
|
|
||||||
:rtype: str
|
|
||||||
"""
|
|
||||||
parts = urlparse(url)
|
parts = urlparse(url)
|
||||||
parts = parts._replace(path=str(Path(parts.path) / extra_path))
|
parts = parts._replace(path=str(Path(parts.path) / extra_path))
|
||||||
return urlunparse(parts)
|
return urlunparse(parts)
|
||||||
|
|
||||||
|
|
||||||
def browse(root: Path) -> None:
|
def browse(root: Path) -> None:
|
||||||
"""Frame the browsing of a root directory in the log output.
|
"""Frame the browsing of a root directory in the log output."""
|
||||||
|
|
||||||
:param root: directory to browse
|
|
||||||
:type root: Path
|
|
||||||
"""
|
|
||||||
paths = []
|
paths = []
|
||||||
for directory, _, files in os.walk(root):
|
for directory, _, files in os.walk(root):
|
||||||
for file in files:
|
for file in files:
|
||||||
|
@ -46,11 +34,7 @@ def browse(root: Path) -> None:
|
||||||
|
|
||||||
|
|
||||||
def cat(file: Path) -> None:
|
def cat(file: Path) -> None:
|
||||||
"""Frame the content of a file in the log output.
|
"""Frame the content of a file in the log output."""
|
||||||
|
|
||||||
:param file: file to read the content from
|
|
||||||
:type file: Path
|
|
||||||
"""
|
|
||||||
text = str(file)
|
text = str(file)
|
||||||
frame(text)
|
frame(text)
|
||||||
log.info(fs.read_file_text(file).rstrip())
|
log.info(fs.read_file_text(file).rstrip())
|
||||||
|
@ -58,20 +42,12 @@ def cat(file: Path) -> None:
|
||||||
|
|
||||||
|
|
||||||
def frame(text: str) -> None:
|
def frame(text: str) -> None:
|
||||||
"""Open a new frame in the log output.
|
"""Open a new frame in the log output."""
|
||||||
|
|
||||||
:param text: text to start the frame with
|
|
||||||
:type text: str
|
|
||||||
"""
|
|
||||||
log.info("%s%s", env.SPCD_OPEN, text)
|
log.info("%s%s", env.SPCD_OPEN, text)
|
||||||
|
|
||||||
|
|
||||||
def shut(text: str) -> None:
|
def shut(text: str) -> None:
|
||||||
"""Close current frame in the log output.
|
"""Close current frame in the log output."""
|
||||||
|
|
||||||
:param text: text to shut the frame with
|
|
||||||
:type text: str
|
|
||||||
"""
|
|
||||||
log.info("%s%s", env.SPCD_SHUT, text)
|
log.info("%s%s", env.SPCD_SHUT, text)
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,11 +57,7 @@ def split() -> None:
|
||||||
|
|
||||||
|
|
||||||
def step(text: str) -> None:
|
def step(text: str) -> None:
|
||||||
"""Increment the step number of the current build process.
|
"""Increment the step number of the current build process."""
|
||||||
|
|
||||||
:param text: text to display
|
|
||||||
:type text: str
|
|
||||||
"""
|
|
||||||
shell.STEP += 1
|
shell.STEP += 1
|
||||||
log.info(env.SPCD_DOWN)
|
log.info(env.SPCD_DOWN)
|
||||||
log.info("%s %s %s", env.SPCD_VERT, shell.STEP, text)
|
log.info("%s %s %s", env.SPCD_VERT, shell.STEP, text)
|
||||||
|
|
Loading…
Reference in a new issue