2013-11-18 20:54:21 +00:00
|
|
|
class SafeRm < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Wraps rm to prevent dangerous deletion of files"
|
2015-01-30 22:38:17 +00:00
|
|
|
homepage "https://launchpad.net/safe-rm"
|
2015-02-16 09:28:21 +00:00
|
|
|
url "https://launchpad.net/safe-rm/trunk/0.12/+download/safe-rm-0.12.tar.gz"
|
2015-05-02 04:30:45 +00:00
|
|
|
sha256 "1c9d3113591e249301fd00fff51152069ab71cd518b32bfcf6848a8d6c3054e2"
|
2015-01-30 22:38:17 +00:00
|
|
|
|
2015-05-02 04:30:45 +00:00
|
|
|
head "http://repo.or.cz/safe-rm.git"
|
2013-11-18 20:54:21 +00:00
|
|
|
|
|
|
|
def install
|
2015-01-30 22:38:17 +00:00
|
|
|
bin.install "safe-rm"
|
2013-11-18 20:54:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2015-02-16 09:28:21 +00:00
|
|
|
foo = testpath/"foo"
|
|
|
|
bar = testpath/"bar"
|
|
|
|
(testpath/".config").mkdir
|
|
|
|
(testpath/".config/safe-rm").write bar
|
|
|
|
touch foo
|
|
|
|
touch bar
|
|
|
|
system "#{bin}/safe-rm", foo
|
|
|
|
assert !File.exist?(foo)
|
|
|
|
shell_output("#{bin}/safe-rm #{bar} 2>&1", 64)
|
|
|
|
assert File.exist?(bar)
|
2013-11-18 20:54:21 +00:00
|
|
|
end
|
|
|
|
end
|