Skip to content

Commit

Permalink
Add support for macOS package installation via brew
Browse files Browse the repository at this point in the history
  • Loading branch information
luismedel committed Oct 16, 2024
1 parent 2be1176 commit 87fe9ea
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .bluish/bluish.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

var:
project_version: "0.6.0"
project_version: "0.7.0"
python_version: "3.12"

jobs:
Expand Down
6 changes: 1 addition & 5 deletions src/bluish/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 20 additions & 0 deletions src/bluish/commands/macos.py
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions src/bluish/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/bluish/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

0 comments on commit 87fe9ea

Please sign in to comment.