|
| 1 | +class Permify < Formula |
| 2 | + desc "Open-source authorization service & policy engine based on Google Zanzibar" |
| 3 | + homepage "https://github.com/Permify/permify" |
| 4 | + url "https://github.com/Permify/permify/archive/refs/tags/v1.4.9.tar.gz" |
| 5 | + sha256 "c1419492151dca5a2fe5f11a51ca50147ab068c2d860609b17e8ad060198e359" |
| 6 | + license "AGPL-3.0-only" |
| 7 | + head "https://github.com/Permify/permify.git", branch: "master" |
| 8 | + |
| 9 | + bottle do |
| 10 | + sha256 cellar: :any_skip_relocation, arm64_tahoe: "9a0c4e53fe54fb821bd6b81cb2639382280924f1f6bf3e64b02ae41615f2f2f1" |
| 11 | + sha256 cellar: :any_skip_relocation, arm64_sequoia: "c5f8b519cce4f36be1a623aa0a95dd68dcb4bd790e1cb79644644d1342e44eec" |
| 12 | + sha256 cellar: :any_skip_relocation, arm64_sonoma: "7d40f2cd662a5c7d210eda4153489951ae0024d19561c4106d9a0b6e2afa6eff" |
| 13 | + sha256 cellar: :any_skip_relocation, sonoma: "511c72f738a1a9b3519a94712c7e71ad37573b601b2f3b8599ed31c18ae0fd30" |
| 14 | + sha256 cellar: :any_skip_relocation, arm64_linux: "925e023f4100a87f24b9a1b51b75186f6a98d6e5b6b474dd1e0edaaa37ed9260" |
| 15 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "6ea13fd525771266f00f40f5e626b80e93cd95900eb95b1097e2dffc232dd4c7" |
| 16 | + end |
| 17 | + |
| 18 | + depends_on "go" => :build |
| 19 | + |
| 20 | + def install |
| 21 | + system "go", "build", *std_go_args(ldflags: "-s -w"), "./cmd/permify" |
| 22 | + |
| 23 | + generate_completions_from_executable(bin/"permify", "completion", shells: [:bash, :zsh, :fish, :pwsh]) |
| 24 | + end |
| 25 | + |
| 26 | + test do |
| 27 | + assert_match version.to_s, shell_output("#{bin}/permify version") |
| 28 | + |
| 29 | + (testpath/"schema.yaml").write <<~YAML |
| 30 | + schema: >- |
| 31 | + entity user {} |
| 32 | +
|
| 33 | + entity document { |
| 34 | + relation viewer @user |
| 35 | + action view = viewer |
| 36 | + } |
| 37 | + YAML |
| 38 | + |
| 39 | + output = shell_output("#{bin}/permify ast #{testpath}/schema.yaml") |
| 40 | + assert_equal "document", JSON.parse(output)["entityDefinitions"]["document"]["name"] |
| 41 | + end |
| 42 | +end |
0 commit comments