jackett 0.22.1382
[Homebrew/homebrew-core.git] / Formula / c / cargo-chef.rb
blobdfa6bf5848a845bb9269021c2cb8d4989fcdfd2a
1 class CargoChef < Formula
2   desc "Cargo subcommand to speed up Rust Docker builds using Docker layer caching"
3   homepage "https://github.com/LukeMathWalker/cargo-chef"
4   url "https://github.com/LukeMathWalker/cargo-chef/archive/refs/tags/v0.1.71.tar.gz"
5   sha256 "788efbe963f932eba64892841025e8c22ad3831ec4d7adfaab6817903da7706b"
6   license any_of: ["Apache-2.0", "MIT"]
8   bottle do
9     sha256 cellar: :any_skip_relocation, arm64_sequoia: "637818a618e5efb0b8417b77e4e96c7d9123f54464cb9fe4c7e11199d2ba67f0"
10     sha256 cellar: :any_skip_relocation, arm64_sonoma:  "3202657821902cf5a88ddfc5605d4d7ec3793fe5d794541d2d96a6b167b75124"
11     sha256 cellar: :any_skip_relocation, arm64_ventura: "2ad84d474218a8bef3060b73a016e3dd7167616f496bcc9c3b9072311c4d84bc"
12     sha256 cellar: :any_skip_relocation, sonoma:        "dfdbb72bf46604cd5f0f35bd8e6b7d5dcd67c14c6233eb186a62a18c1e35cbf4"
13     sha256 cellar: :any_skip_relocation, ventura:       "10c7510f672ed91552e10e702ab9f67014470e3375076552804c2666fd827fe0"
14     sha256 cellar: :any_skip_relocation, x86_64_linux:  "7a3b2ee0048b5f03c09967054afd7be85182404094bea559326b4ea44aa8d5d0"
15   end
17   depends_on "rust" => :build
18   depends_on "rustup" => :test
20   def install
21     system "cargo", "install", *std_cargo_args
22   end
24   test do
25     # Show that we can use a different toolchain than the one provided by the `rust` formula.
26     # https://github.com/Homebrew/homebrew-core/pull/134074#pullrequestreview-1484979359
27     ENV.prepend_path "PATH", Formula["rustup"].bin
28     system "rustup", "default", "beta"
29     system "rustup", "set", "profile", "minimal"
31     (testpath/"Cargo.toml").write <<~TOML
32       [package]
33       name = "test_project"
34       version = "0.1.0"
35       edition = "2021"
36     TOML
38     (testpath/"src/main.rs").write <<~RUST
39       fn main() {
40         println!("Hello BrewTestBot!");
41       }
42     RUST
44     recipe_file = testpath/"recipe.json"
45     system bin/"cargo-chef", "chef", "prepare", "--recipe-path", recipe_file
46     assert_equal "Cargo.toml", JSON.parse(recipe_file.read)["skeleton"]["manifests"].first["relative_path"]
48     assert_match "cargo-chef #{version}", shell_output("#{bin}/cargo-chef --version")
49   end
50 end