From de1c53afc1c2d5c2d46e914135a6f51e780600f8 Mon Sep 17 00:00:00 2001 From: Brandon Kaplowitz Date: Wed, 30 Oct 2024 02:40:33 -0400 Subject: [PATCH] rip2 0.9.0 (new formula) provides maintained version of rip under new rip2 name Signed-off-by: Rui Chen --- Formula/r/rip2.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Formula/r/rip2.rb diff --git a/Formula/r/rip2.rb b/Formula/r/rip2.rb new file mode 100644 index 000000000000..aac1dfd5d202 --- /dev/null +++ b/Formula/r/rip2.rb @@ -0,0 +1,28 @@ +class Rip < Formula + desc "Safe and ergonomic alternative to rm" + homepage "https://github.com/MilesCranmer/rip2" + url "https://github.com/MilesCranmer/rip2/archive/refs/tags/v0.9.0.tar.gz" + sha256 "e8519e21877c8883f9f2a700036c53bce62b5ee0afaef47a12780999457e2633" + license "GPL-3.0-or-later" + head "https://github.com/MilesCranmer/rip2.git", branch: "master" + + depends_on "rust" => :build + + def install + system "cargo", "install", *std_cargo_args(path: ".") + + generate_completions_from_executable(bin/"rip", "completion") + (share/"elvish/lib/rip.elv").write Utils.safe_popen_read(bin/"rip", "completions", "elvish") + (share/"powershell/completions/_rip.ps1").write Utils.safe_popen_read(bin/"rip", "completions", "powershell") + (share/"nu/completions/rip.nu").write Utils.safe_popen_read(bin/"rip", "completions", "nushell") + end + + test do + # Create a test file and verify rip can delete it + test_file = testpath/"test.txt" + touch test_file + system bin/"rip", "--graveyard", testpath/"graveyard", test_file.to_s + assert_predicate testpath/"graveyard", :exist? + refute_predicate test_file, :exist? + end +end