From 45eb42a81abb59cdfdb2dd788c2bf7c32fece3b1 Mon Sep 17 00:00:00 2001 From: Alexis-Maurer Fortin Date: Fri, 13 Feb 2026 12:36:54 -0500 Subject: [PATCH] new formula to fetch binaries --- .github/workflows/test.yml | 6 +++--- Formula/bagel.rb | 37 +++++++++++++++++++++++-------------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c56186d..4032546 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,11 +16,11 @@ jobs: id: cache uses: actions/cache@v3 with: - path: ${{ steps:set-up-homebrew.outputs.gems-path }} - key: ${{ runner.os }}-rubygems-${{ steps:set-up-homebrew.outputs.gems-hash }} + path: ${{ steps.set-up-homebrew.outputs.gems-path }} + key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} restore-keys: ${{ runner.os }}-rubygems- - name: Run brew test run: | - brew install --build-from-source Formula/bagel.rb + brew install Formula/bagel.rb brew test Formula/bagel.rb diff --git a/Formula/bagel.rb b/Formula/bagel.rb index 14194ff..e09ef62 100644 --- a/Formula/bagel.rb +++ b/Formula/bagel.rb @@ -1,23 +1,33 @@ class Bagel < Formula desc "CLI to audit posture and evaluate compromise blast radius" homepage "https://boostsecurityio.github.io/bagel/" - url "https://github.com/boostsecurityio/bagel/archive/refs/tags/v0.2.0.tar.gz" - sha256 "b7317200cfc6d7556c6c1fbeb244c8397f68fc2998348bf07dbdc4f9bed46506" + version "0.2.0" license "GPL-3.0-only" - head "https://github.com/boostsecurityio/bagel.git", branch: "main" - depends_on "go" => :build - - def install - ldflags = %W[ - -s -w - -X main.Version=#{version} - -X main.Commit=#{tap.user} - -X main.Date=#{time.iso8601} - ] + on_macos do + if Hardware::CPU.arm? + url "https://github.com/boostsecurityio/bagel/releases/download/v#{version}/bagel_Darwin_arm64.tar.gz" + sha256 "ee9908ff268ec00ec9524f817abc5855e29e06aa52bb7e4cce9e129c921a0f1e" + end + if Hardware::CPU.intel? + url "https://github.com/boostsecurityio/bagel/releases/download/v#{version}/bagel_Darwin_x86_64.tar.gz" + sha256 "053dd417552d76d88e337973231887628194684b6d1cae762967eaef202d2e6a" + end + end - system "go", "build", *std_go_args(ldflags: ldflags), "./cmd/bagel" + on_linux do + if Hardware::CPU.arm? + url "https://github.com/boostsecurityio/bagel/releases/download/v#{version}/bagel_Linux_arm64.tar.gz" + sha256 "c02056252b2434ae9ede2edd86fafa684ff9f9a7c3c47bf41d2e7de465824ff0" + end + if Hardware::CPU.intel? + url "https://github.com/boostsecurityio/bagel/releases/download/v#{version}/bagel_Linux_x86_64.tar.gz" + sha256 "81eefb03a6a89a07c34c9c7cfc1861a8477a80c14451b8a13b582f7132660654" + end + end + def install + bin.install "bagel" generate_completions_from_executable(bin/"bagel", "completion") end @@ -37,7 +47,6 @@ def install aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY INI - # Removed the explicit '0' to satisfy brew audit output = shell_output("#{bin}/bagel scan --config #{testpath}/bagel.yaml") assert_match "AWS", output end