diff --git a/.bluish/bluish.yaml b/.bluish/bluish.yaml index 3dc2560..94330bf 100644 --- a/.bluish/bluish.yaml +++ b/.bluish/bluish.yaml @@ -1,6 +1,6 @@ var: - project_version: "0.6.0" + project_version: "0.7.0" python_version: "3.12" jobs: diff --git a/src/bluish/app.py b/src/bluish/app.py index fb8836b..6097545 100644 --- a/src/bluish/app.py +++ b/src/bluish/app.py @@ -256,9 +256,5 @@ def dispatch_job(file: str, job_id: str): app.run(host=host, port=port) -def test_adhoc(): - blu_cli("ci:fix", False, "DEBUG") - - if __name__ == "__main__": - test_adhoc() + pass diff --git a/src/bluish/commands/macos.py b/src/bluish/commands/macos.py new file mode 100644 index 0000000..c473e45 --- /dev/null +++ b/src/bluish/commands/macos.py @@ -0,0 +1,20 @@ +from bluish.action import action +from bluish.context import StepContext +from bluish.logging import error, info +from bluish.process import ProcessResult, install_package + + +@action("macos/install-packages", required_inputs=["packages"]) +def system_install_packages(step: StepContext) -> ProcessResult: + package_str = " ".join(step.inputs["packages"]) + flavor = "macos" + + info(f"Installing packages {package_str}...") + + result = install_package( + step.job.runs_on_host, step.inputs["packages"], flavor=flavor + ) + if result.failed: + error(f"Failed to install packages {package_str}\n{result.error}") + + return result diff --git a/src/bluish/core.py b/src/bluish/core.py index a0e45eb..1ade945 100644 --- a/src/bluish/core.py +++ b/src/bluish/core.py @@ -11,6 +11,7 @@ class ExecutionStatus(Enum): def init_commands() -> None: import bluish.commands.core # noqa import bluish.commands.linux # noqa + import bluish.commands.macos # noqa import bluish.commands.docker # noqa import bluish.commands.git # noqa diff --git a/src/bluish/process.py b/src/bluish/process.py index 07e352b..027ae42 100644 --- a/src/bluish/process.py +++ b/src/bluish/process.py @@ -222,5 +222,7 @@ def install_package( return run(f"zypper install -y {package_list}", host_opts) elif flavor in ("gentoo"): return run(f"emerge -v {package_list}", host_opts) + elif flavor in ("macos"): + return run(f"HOMEBREW_NO_AUTO_UPDATE=1 brew install {package_list}", host_opts) else: raise ValueError(f"Unsupported flavor: {flavor}")