|
| 1 | +class Alejandra < Formula |
| 2 | + desc "Command-line tool for formatting Nix Code" |
| 3 | + homepage "https://kamadorueda.com/alejandra/" |
| 4 | + url "https://github.com/kamadorueda/alejandra/archive/refs/tags/4.0.0.tar.gz" |
| 5 | + sha256 "f3f9989c3fb6a56e2050bf5329692fae32a2b54be7c0652aa394afe4660ebb74" |
| 6 | + license "Unlicense" |
| 7 | + head "https://github.com/kamadorueda/alejandra.git", branch: "main" |
| 8 | + |
| 9 | + bottle do |
| 10 | + sha256 cellar: :any_skip_relocation, arm64_sequoia: "a105b8e8c06f4e240b052d62e5b271e4a1c196f8367780ae22fe4bf705ad65b1" |
| 11 | + sha256 cellar: :any_skip_relocation, arm64_sonoma: "e02b48f1e647cf69ccbb6846c8335f912cc08344f7107af6f3b4ad3780981f8c" |
| 12 | + sha256 cellar: :any_skip_relocation, arm64_ventura: "d220e43933b6412b9b2c55193af67aa046a935f282f7bb2bcbe73ce0987561fe" |
| 13 | + sha256 cellar: :any_skip_relocation, sonoma: "82324a20fbc443a94c675997c412c0394d9dc511f7bb72e9b36e1861deeee324" |
| 14 | + sha256 cellar: :any_skip_relocation, ventura: "bbdac460582dfb76e32ca4976eae2ca4a58ab2ce5aa54091136040d9634b9af8" |
| 15 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "34b9aa4a4f9d81bec8bd22b0f2199000be9469a732f3c140f5fabd7a4e766c04" |
| 16 | + end |
| 17 | + |
| 18 | + depends_on "rust" => :build |
| 19 | + |
| 20 | + def install |
| 21 | + system "cargo", "install", *std_cargo_args(path: "src/alejandra_cli") |
| 22 | + end |
| 23 | + |
| 24 | + test do |
| 25 | + assert_equal "Alejandra #{version}", shell_output("#{bin}/alejandra --version").chomp |
| 26 | + |
| 27 | + ENV["LC_ALL"] = "en_US.UTF-8" |
| 28 | + input_nix = "{description=\"Demo\";outputs={self}:{};}" |
| 29 | + output_nix = "{\n description = \"Demo\";\n outputs = {self}: {};\n}" |
| 30 | + |
| 31 | + (testpath/"alejandra_test.nix").write input_nix |
| 32 | + system bin/"alejandra", "alejandra_test.nix" |
| 33 | + assert_equal output_nix, (testpath/"alejandra_test.nix").read.strip |
| 34 | + end |
| 35 | +end |
0 commit comments