Commit 69052d22ed
Verified · cmc
Layout: unified · split
Formula/ambient-companions.rb +26 −2
| @@ -2,8 +2,8 @@ class AmbientCompanions < Formula | |||
| 2 | desc "Ambient system companions over one privacy-preserving signal daemon" | 2 | desc "Ambient system companions over one privacy-preserving signal daemon" |
| 3 | homepage "https://gitbay.org/krz/ambient-companions" | 3 | homepage "https://gitbay.org/krz/ambient-companions" |
| 4 | url "https://gitbay.org/krz/ambient-companions.git", | 4 | url "https://gitbay.org/krz/ambient-companions.git", |
| 5 | tag: "v1.1.0", | 5 | tag: "v1.2.0", |
| 6 | revision: "7bf3941d56f48fc226a46d7b2f26f05b512c321b" | 6 | revision: "5358b7a0828e4b77a1b7e2eb438b14449ad1aa8e" |
| 7 | license "0BSD" | 7 | license "0BSD" |
| 8 | head "https://gitbay.org/krz/ambient-companions.git", branch: "main" | 8 | head "https://gitbay.org/krz/ambient-companions.git", branch: "main" |
| 9 | 9 | ||
| @@ -16,6 +16,7 @@ class AmbientCompanions < Formula | |||
| 16 | system "cargo", "install", *std_cargo_args(path: "crates/signald") | 16 | system "cargo", "install", *std_cargo_args(path: "crates/signald") |
| 17 | system "cargo", "install", *std_cargo_args(path: "crates/terminal-garden") | 17 | system "cargo", "install", *std_cargo_args(path: "crates/terminal-garden") |
| 18 | system "cargo", "install", *std_cargo_args(path: "crates/terminal-pet") | 18 | system "cargo", "install", *std_cargo_args(path: "crates/terminal-pet") |
| 19 | system "cargo", "install", *std_cargo_args(path: "crates/pet-life") | ||
| 19 | 20 | ||
| 20 | # The IOKit collector runs out of process as a child of signald. | 21 | # The IOKit collector runs out of process as a child of signald. |
| 21 | # --disable-sandbox: SwiftPM sandboxes its own manifest compile, and that | 22 | # --disable-sandbox: SwiftPM sandboxes its own manifest compile, and that |
| @@ -26,6 +27,18 @@ class AmbientCompanions < Formula | |||
| 26 | "--scratch-path", buildpath/"swift-build" | 27 | "--scratch-path", buildpath/"swift-build" |
| 27 | bin.install buildpath/"swift-build/release/macos-collector" | 28 | bin.install buildpath/"swift-build/release/macos-collector" |
| 28 | 29 | ||
| 30 | # The menu-bar face. SwiftPM cannot emit a .app, so the repo's own script | ||
| 31 | # assembles the bundle; installing it into the prefix rather than shipping | ||
| 32 | # a cask keeps this build-from-source, which also means Gatekeeper never | ||
| 33 | # quarantines it. | ||
| 34 | system "swift", "build", "-c", "release", "--disable-sandbox", | ||
| 35 | "--package-path", "menubar-pet", | ||
| 36 | "--scratch-path", buildpath/"menubar-build" | ||
| 37 | system "menubar-pet/scripts/bundle.sh", | ||
| 38 | buildpath/"menubar-build/release/menubar-pet", prefix | ||
| 39 | # pet-life sits beside the app binary so the bundle finds it without PATH. | ||
| 40 | (prefix/"menubar-pet.app/Contents/MacOS").install_symlink bin/"pet-life" | ||
| 41 | |||
| 29 | # Sourced from the user's .zshrc; see the README install section. | 42 | # Sourced from the user's .zshrc; see the README install section. |
| 30 | pkgshare.install "shell-hooks/signald-hooks.zsh" | 43 | pkgshare.install "shell-hooks/signald-hooks.zsh" |
| 31 | # The launchd template, for a manual install. `brew services` uses the | 44 | # The launchd template, for a manual install. `brew services` uses the |
| @@ -52,6 +65,11 @@ class AmbientCompanions < Formula | |||
| 52 | 65 | ||
| 53 | Then source the terminal collector hooks from your .zshrc: | 66 | Then source the terminal collector hooks from your .zshrc: |
| 54 | source "#{opt_pkgshare}/signald-hooks.zsh" | 67 | source "#{opt_pkgshare}/signald-hooks.zsh" |
| 68 | |||
| 69 | The menu-bar pet is an app, not a service. Launch it with: | ||
| 70 | open "#{opt_prefix}/menubar-pet.app" | ||
| 71 | and add it under System Settings > General > Login Items to keep it. | ||
| 72 | It has one life: neglect it for a week and it dies for good. | ||
| 55 | EOS | 73 | EOS |
| 56 | end | 74 | end |
| 57 | 75 | ||
| @@ -59,6 +77,12 @@ class AmbientCompanions < Formula | |||
| 59 | assert_match version.to_s, shell_output("#{bin}/signald --version") | 77 | assert_match version.to_s, shell_output("#{bin}/signald --version") |
| 60 | assert_match version.to_s, shell_output("#{bin}/terminal-garden --version") | 78 | assert_match version.to_s, shell_output("#{bin}/terminal-garden --version") |
| 61 | assert_match version.to_s, shell_output("#{bin}/terminal-pet --version") | 79 | assert_match version.to_s, shell_output("#{bin}/terminal-pet --version") |
| 80 | assert_match version.to_s, shell_output("#{bin}/pet-life --version") | ||
| 81 | # The app is only an app if the bundle is intact. | ||
| 82 | assert_path_exists prefix/"menubar-pet.app/Contents/MacOS/menubar-pet" | ||
| 83 | assert_match "true", | ||
| 84 | shell_output("plutil -extract LSUIElement raw " \ | ||
| 85 | "#{prefix}/menubar-pet.app/Contents/Info.plist") | ||
| 62 | # Unknown options exit 2 rather than being taken for a repository path. | 86 | # Unknown options exit 2 rather than being taken for a repository path. |
| 63 | shell_output("#{bin}/signald --nonexistent-option 2>&1", 2) | 87 | shell_output("#{bin}/signald --nonexistent-option 2>&1", 2) |
| 64 | # One real IOKit read, no root. --once writes raw wire frames to stdout and | 88 | # One real IOKit read, no root. --once writes raw wire frames to stdout and |