55 lines
1.9 KiB
Ruby
55 lines
1.9 KiB
Ruby
class Cloc < Formula
|
|
desc "Statistics utility to count lines of code"
|
|
homepage "https://github.com/AlDanial/cloc/"
|
|
url "https://github.com/AlDanial/cloc/archive/v1.72.tar.gz"
|
|
sha256 "2d2c57478b6c8b77d90d8b2aa278a3bd1f18251f5cf3cfeb017db2c27ad86af2"
|
|
head "https://github.com/AlDanial/cloc.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "20ad35f8364a77e84cc412f1bb1a86d9b96876eed88afbdc71017bec227290ea" => :sierra
|
|
sha256 "a8c39fc4daf93dc56e24a55a76414f0b64e51e2c443de10c24e4b1c5b9b5a2b1" => :el_capitan
|
|
sha256 "d6eef98c928c222e5cc7c675b23774ec87a62076c5642c92555c36e749d97996" => :yosemite
|
|
end
|
|
|
|
resource "Regexp::Common" do
|
|
url "https://cpan.metacpan.org/authors/id/A/AB/ABIGAIL/Regexp-Common-2016060801.tar.gz"
|
|
sha256 "fc2fc178facf0292974d6511bad677dd038fe60d7ac118e3b83a1ca9e98a8403"
|
|
end
|
|
|
|
resource "Algorithm::Diff" do
|
|
url "https://cpan.metacpan.org/authors/id/T/TY/TYEMQ/Algorithm-Diff-1.1903.tar.gz"
|
|
sha256 "30e84ac4b31d40b66293f7b1221331c5a50561a39d580d85004d9c1fff991751"
|
|
end
|
|
|
|
def install
|
|
ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5"
|
|
|
|
# These are shipped as standard with OS X/macOS' default Perl, but
|
|
# because upstream has chosen to use "#!/usr/bin/env perl" cloc will
|
|
# use whichever Perl is in the PATH, which isn't guaranteed to include
|
|
# these modules. Vendor them to be safe.
|
|
resources.each do |r|
|
|
r.stage do
|
|
system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}"
|
|
system "make", "install"
|
|
end
|
|
end
|
|
|
|
system "make", "-C", "Unix", "prefix=#{libexec}", "install"
|
|
bin.install libexec/"bin/cloc"
|
|
bin.env_script_all_files(libexec/"bin", :PERL5LIB => ENV["PERL5LIB"])
|
|
man1.install libexec/"share/man/man1/cloc.1"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.c").write <<-EOS.undent
|
|
#include <stdio.h>
|
|
int main(void) {
|
|
return 0;
|
|
}
|
|
EOS
|
|
|
|
assert_match "1,C,0,0,4", shell_output("#{bin}/cloc --csv .")
|
|
end
|
|
end
|