Skip to content

Commit

Permalink
rip2 0.9.0 (new formula)
Browse files Browse the repository at this point in the history
provides maintained version of rip under new rip2 name
  • Loading branch information
bkaplowitz committed Oct 30, 2024
1 parent 04d7388 commit a5e1c06
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Formula/r/rip2.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
class Rip2 < 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 shell completions
(buildpath/"rip.bash").write Utils.safe_popen_read(bin/"rip", "completions", "bash")
(buildpath/"rip.fish").write Utils.safe_popen_read(bin/"rip", "completions", "fish")
(buildpath/"_rip").write Utils.safe_popen_read(bin/"rip", "completions", "zsh")
(buildpath/"rip.elv").write Utils.safe_popen_read(bin/"rip", "completions", "elvish")
(buildpath/"_rip.ps1").write Utils.safe_popen_read(bin/"rip", "completions", "powershell")
(buildpath/"rip.nu").write Utils.safe_popen_read(bin/"rip", "completions", "nushell")

bash_completion.install "rip.bash" => "rip"
fish_completion.install "rip.fish"
zsh_completion.install "_rip"
(share/"elvish/lib").install "rip.elv"
(share/"powershell/completions").install "_rip.ps1"
(share/"nu/completions").install "rip.nu"
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

0 comments on commit a5e1c06

Please sign in to comment.