From e8dbea8f1b2a731a0987b91c682d530b1a6db95d Mon Sep 17 00:00:00 2001 From: Adrian Ho Date: Tue, 31 Jan 2023 17:23:32 +0800 Subject: [PATCH] cargo-about: add 0.5.2 bottle. --- Formula/cargo-about.rb | 54 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Formula/cargo-about.rb diff --git a/Formula/cargo-about.rb b/Formula/cargo-about.rb new file mode 100644 index 00000000000..fa030b8b0e1 --- /dev/null +++ b/Formula/cargo-about.rb @@ -0,0 +1,54 @@ +class CargoAbout < Formula + desc "Cargo plugin to generate list of all licenses for a crate" + homepage "https://github.com/EmbarkStudios/cargo-about" + url "https://github.com/EmbarkStudios/cargo-about/archive/refs/tags/0.5.2.tar.gz" + sha256 "7e37c2d47273dfedbace33d34f768690a9a5ef7e04a347dd1a3f5b0a979ee50a" + license any_of: ["Apache-2.0", "MIT"] + head "https://github.com/EmbarkStudios/cargo-about.git", branch: "main" + + bottle do + root_url "https://github.com/gromgit/homebrew-core-mojave/releases/download/cargo-about" + sha256 cellar: :any_skip_relocation, mojave: "9ab71e238dc7978c2dee4263358cc7b968362af39b61f47303b5b58809995d12" + end + + depends_on "rust" # uses `cargo` at runtime + + def install + system "cargo", "install", *std_cargo_args + end + + test do + crate = testpath/"demo-crate" + mkdir crate do + (crate/"src/main.rs").write <<~EOS + #[cfg(test)] + mod tests { + #[test] + fn test_it() { + assert_eq!(1 + 1, 2); + } + } + EOS + (crate/"Cargo.toml").write <<~EOS + [package] + name = "demo-crate" + version = "0.1.0" + license = "MIT" + EOS + + system bin/"cargo-about", "init" + assert_predicate crate/"about.hbs", :exist? + + expected = <<~EOS + accepted = [ + "Apache-2.0", + "MIT", + ] + EOS + assert_equal expected, (crate/"about.toml").read + + output = shell_output("cargo about generate about.hbs") + assert_match "The above copyright notice and this permission notice", output + end + end +end