c7749aa697
switch to Debian as upstream remove head spec
33 lines
1 KiB
Ruby
33 lines
1 KiB
Ruby
class Checkbashisms < Formula
|
|
desc "Checks for bashisms in shell scripts"
|
|
homepage "https://launchpad.net/ubuntu/+source/devscripts/"
|
|
url "https://mirrors.ocf.berkeley.edu/debian/pool/main/d/devscripts/devscripts_2.18.2.tar.xz"
|
|
mirror "https://mirrorservice.org/sites/ftp.debian.org/debian/pool/main/d/devscripts/devscripts_2.18.2.tar.xz"
|
|
sha256 "645b5814be7a9d1f4f3df1931f6d9c645e1fd75071ddafabd798f9459277d435"
|
|
|
|
bottle :unneeded
|
|
|
|
def install
|
|
inreplace "scripts/checkbashisms.pl" do |s|
|
|
s.gsub! "###VERSION###", version
|
|
s.gsub! "#!/usr/bin/perl", "#!/usr/bin/perl -T"
|
|
end
|
|
|
|
bin.install "scripts/checkbashisms.pl" => "checkbashisms"
|
|
man1.install "scripts/checkbashisms.1"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.sh").write <<~EOS
|
|
#!/bin/sh
|
|
|
|
if [[ "home == brew" ]]; then
|
|
echo "dog"
|
|
fi
|
|
EOS
|
|
expected = <<~EOS
|
|
(alternative test command ([[ foo ]] should be [ foo ])):
|
|
EOS
|
|
assert_match expected, shell_output("#{bin}/checkbashisms #{testpath}/test.sh 2>&1", 1)
|
|
end
|
|
end
|