@@ -20,12 +20,26 @@ class Granted < Formula
2020 def install
2121 ldflags = "-s -w -X github.com/common-fate/granted/internal/build.Version=#{ version } "
2222 system "go" , "build" , *std_go_args ( ldflags :) , "./cmd/granted"
23+ bin . install_symlink "granted" => "assumego"
24+ # these must be in bin, and not sourced automatically
25+ bin . install "scripts/assume"
26+ bin . install "scripts/assume.fish"
2327 end
2428
2529 test do
2630 assert_match version . to_s , shell_output ( "#{ bin } /granted --version" )
2731
2832 output = shell_output ( "#{ bin } /granted auth configure 2>&1" , 1 )
2933 assert_match "[✘] please provide a url argument" , output
34+
35+ ENV [ "GRANTED_ALIAS_CONFIGURED" ] = "true"
36+ assert_match version . to_s , shell_output ( "#{ bin } /assume --version" )
37+ assert_match version . to_s , shell_output ( "#{ bin } /assumego --version" )
38+
39+ # assume is interactive; pipe_output provides empty stdin causing prompts to fail.
40+ # Match varies by environment: "does not match" (with browser), "Could not find
41+ # default browser" (no browser configured), or "EOF" (when stdin closes).
42+ output = pipe_output ( "#{ bin } /assume non-existing-role 2>&1" , "" )
43+ assert_match ( /does not match any profiles|Could not find default browser|EOF/ , output )
3044 end
3145end
0 commit comments