-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |