3b9bb768e0
Closes #36145. Signed-off-by: FX Coudert <fxcoudert@gmail.com>
32 lines
930 B
Ruby
32 lines
930 B
Ruby
class Checkbashisms < Formula
|
|
desc "Checks for bashisms in shell scripts"
|
|
homepage "https://launchpad.net/ubuntu/+source/devscripts/"
|
|
url "https://deb.debian.org/debian/pool/main/d/devscripts/devscripts_2.19.2.tar.xz"
|
|
sha256 "6874487cdafaa05f1e72b119a5db4c83caae2631ae468d45a24a72cf3f7393b9"
|
|
|
|
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
|