Skip to content

Instantly share code, notes, and snippets.

@vladimyr
Last active June 23, 2020 12:46
Show Gist options
  • Save vladimyr/194fd6b63a8f7de6e5c719d0cc728716 to your computer and use it in GitHub Desktop.
Save vladimyr/194fd6b63a8f7de6e5c719d0cc728716 to your computer and use it in GitHub Desktop.
diff --git a/Formula/latexindent.rb b/Formula/latexindent.rb
index 0492afe2f6..aa9ab37310 100644
--- a/Formula/latexindent.rb
+++ b/Formula/latexindent.rb
@@ -1,14 +1,44 @@
class Latexindent < Formula
desc "Add indentation to LaTeX files"
- homepage "https://github.com/cmhughes/latexindent.pl"
+ homepage "https://ctan.org/pkg/latexindent"
url "https://github.com/cmhughes/latexindent.pl/archive/V3.8.2.tar.gz"
sha256 "a134e27d56b7daee2bea37563424f996fc559bc8019e92213261b25cdb84a688"
depends_on "perl"
- resource "YAML::Tiny" do
- url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/YAML-Tiny-1.73.tar.gz"
- sha256 "bc315fa12e8f1e3ee5e2f430d90b708a5dc7e47c867dba8dce3a6b8fbe257744"
+ resource "B::Hooks::EndOfScope" do
+ url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/B-Hooks-EndOfScope-0.24.tar.gz"
+ sha256 "03aa3dfe5d0aa6471a96f43fe8318179d19794d4a640708f0288f9216ec7acc6"
+ end
+
+ resource "Class::Data::Inheritable" do
+ url "https://cpan.metacpan.org/authors/id/T/TM/TMTM/Class-Data-Inheritable-0.08.tar.gz"
+ sha256 "9967feceea15227e442ec818723163eb6d73b8947e31f16ab806f6e2391af14a"
+ end
+
+ resource "Devel::GlobalDestruction" do
+ url "https://cpan.metacpan.org/authors/id/H/HA/HAARG/Devel-GlobalDestruction-0.14.tar.gz"
+ sha256 "34b8a5f29991311468fe6913cadaba75fd5d2b0b3ee3bb41fe5b53efab9154ab"
+ end
+
+ resource "Devel::StackTrace" do
+ url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Devel-StackTrace-2.04.tar.gz"
+ sha256 "cd3c03ed547d3d42c61fa5814c98296139392e7971c092e09a431f2c9f5d6855"
+ end
+
+ resource "Dist::CheckConflicts" do
+ url "https://cpan.metacpan.org/authors/id/D/DO/DOY/Dist-CheckConflicts-0.11.tar.gz"
+ sha256 "ea844b9686c94d666d9d444321d764490b2cde2f985c4165b4c2c77665caedc4"
+ end
+
+ resource "Eval::Closure" do
+ url "https://cpan.metacpan.org/authors/id/D/DO/DOY/Eval-Closure-0.14.tar.gz"
+ sha256 "ea0944f2f5ec98d895bef6d503e6e4a376fea6383a6bc64c7670d46ff2218cad"
+ end
+
+ resource "Exception::Class" do
+ url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Exception-Class-1.44.tar.gz"
+ sha256 "33f3fbf8b138d3b04ea4ec0ba83fb0df6ba898806bcf4ef393d4cafc1a23ee0d"
end
resource "File::HomeDir" do
@@ -21,9 +51,9 @@ class Latexindent < Formula
sha256 "b79dc2244b2d97b6f27167fc3b7799ef61a179040f3abd76ce1e0a3b0bc4e078"
end
- resource "Unicode::GCString" do
- url "https://cpan.metacpan.org/authors/id/N/NE/NEZUMI/Unicode-LineBreak-2019.001.tar.gz"
- sha256 "486762e4cacddcc77b13989f979a029f84630b8175e7fef17989e157d4b6318a"
+ resource "Log::Dispatch" do
+ url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Log-Dispatch-2.69.tar.gz"
+ sha256 "58624c0a0c4c620873efb7ce2f11dde55fa2e24c22be2551f548ff3624585277"
end
resource "Log::Log4perl" do
@@ -31,9 +61,114 @@ class Latexindent < Formula
sha256 "b739187f519146cb6bebcfc427c64b1f4138b35c5f4c96f46a21ed4a43872e16"
end
- resource "Log::Dispatch::File" do
- url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Log-Dispatch-2.69.tar.gz"
- sha256 "58624c0a0c4c620873efb7ce2f11dde55fa2e24c22be2551f548ff3624585277"
+ resource "MIME::Charset" do
+ url "https://cpan.metacpan.org/authors/id/N/NE/NEZUMI/MIME-Charset-1.012.2.tar.gz"
+ sha256 "878c779c0256c591666bd06c0cde4c0d7820eeeb98fd1183082aee9a1e7b1d13"
+ end
+
+ resource "MRO::Compat" do
+ url "https://cpan.metacpan.org/authors/id/H/HA/HAARG/MRO-Compat-0.13.tar.gz"
+ sha256 "8a2c3b6ccc19328d5579d02a7d91285e2afd85d801f49d423a8eb16f323da4f8"
+ end
+
+ resource "Mac::SystemDirectory" do
+ url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/Mac-SystemDirectory-0.13.tar.gz"
+ sha256 "8730740e4ff3ea4812139b0787dbd1b544e093a08218d908071629b70fde3684"
+ end
+
+ resource "Module::Build" do
+ url "https://cpan.metacpan.org/authors/id/L/LE/LEONT/Module-Build-0.4231.tar.gz"
+ sha256 "7e0f4c692c1740c1ac84ea14d7ea3d8bc798b2fb26c09877229e04f430b2b717"
+ end
+
+ resource "Module::Implementation" do
+ url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Module-Implementation-0.09.tar.gz"
+ sha256 "c15f1a12f0c2130c9efff3c2e1afe5887b08ccd033bd132186d1e7d5087fd66d"
+ end
+
+ resource "Module::Runtime" do
+ url "https://cpan.metacpan.org/authors/id/Z/ZE/ZEFRAM/Module-Runtime-0.016.tar.gz"
+ sha256 "68302ec646833547d410be28e09676db75006f4aa58a11f3bdb44ffe99f0f024"
+ end
+
+ resource "Package::Stash" do
+ url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/Package-Stash-0.38.tar.gz"
+ sha256 "c58ee8844df2dda38e3bf66fdf443439aaefaef1a33940edf2055f0afd223a7f"
+ end
+
+ resource "Package::Stash::XS" do
+ url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/Package-Stash-XS-0.29.tar.gz"
+ sha256 "d3676ba94641e03d6a30e951f09266c4c3ca3f5b58aa7b314a67f28e419878aa"
+ end
+
+ resource "Params::ValidationCompiler" do
+ url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Params-ValidationCompiler-0.30.tar.gz"
+ sha256 "dc5bee23383be42765073db284bed9fbd819d4705ad649c20b644452090d16cb"
+ end
+
+ resource "Role::Tiny" do
+ url "https://cpan.metacpan.org/authors/id/H/HA/HAARG/Role-Tiny-2.001004.tar.gz"
+ sha256 "92ba5712850a74102c93c942eb6e7f62f7a4f8f483734ed289d08b324c281687"
+ end
+
+ resource "Specio" do
+ url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Specio-0.46.tar.gz"
+ sha256 "0bf42aa116076d6efc18f72b72c7acb5638bd41c0aa09aecc12fc8bf9ceb9596"
+ end
+
+ resource "Sub::Exporter::Progressive" do
+ url "https://cpan.metacpan.org/authors/id/F/FR/FREW/Sub-Exporter-Progressive-0.001013.tar.gz"
+ sha256 "d535b7954d64da1ac1305b1fadf98202769e3599376854b2ced90c382beac056"
+ end
+
+ resource "Sub::Identify" do
+ url "https://cpan.metacpan.org/authors/id/R/RG/RGARCIA/Sub-Identify-0.14.tar.gz"
+ sha256 "068d272086514dd1e842b6a40b1bedbafee63900e5b08890ef6700039defad6f"
+ end
+
+ resource "Sub::Quote" do
+ url "https://cpan.metacpan.org/authors/id/H/HA/HAARG/Sub-Quote-2.006006.tar.gz"
+ sha256 "6e4e2af42388fa6d2609e0e82417de7cc6be47223f576592c656c73c7524d89d"
+ end
+
+ resource "Test::Fatal" do
+ url "https://cpan.metacpan.org/authors/id/R/RJ/RJBS/Test-Fatal-0.014.tar.gz"
+ sha256 "bcdcef5c7b2790a187ebca810b0a08221a63256062cfab3c3b98685d91d1cbb0"
+ end
+
+ resource "Try::Tiny" do
+ url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/Try-Tiny-0.30.tar.gz"
+ sha256 "da5bd0d5c903519bbf10bb9ba0cb7bcac0563882bcfe4503aee3fb143eddef6b"
+ end
+
+ resource "Unicode::LineBreak" do
+ url "https://cpan.metacpan.org/authors/id/N/NE/NEZUMI/Unicode-LineBreak-2019.001.tar.gz"
+ sha256 "486762e4cacddcc77b13989f979a029f84630b8175e7fef17989e157d4b6318a"
+ end
+
+ resource "Variable::Magic" do
+ url "https://cpan.metacpan.org/authors/id/V/VP/VPIT/Variable-Magic-0.62.tar.gz"
+ sha256 "3f9a18517e33f006a9c2fc4f43f01b54abfe6ff2eae7322424f31069296b615c"
+ end
+
+ resource "XString" do
+ url "https://cpan.metacpan.org/authors/id/A/AT/ATOOMIC/XString-0.002.tar.gz"
+ sha256 "260e252f7367228c9b4e43ef50c0becb04c4781de660577b3086cc106c0028c0"
+ end
+
+ resource "YAML::Tiny" do
+ url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/YAML-Tiny-1.73.tar.gz"
+ sha256 "bc315fa12e8f1e3ee5e2f430d90b708a5dc7e47c867dba8dce3a6b8fbe257744"
+ end
+
+ resource "namespace::autoclean" do
+ url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/namespace-autoclean-0.29.tar.gz"
+ sha256 "45ebd8e64a54a86f88d8e01ae55212967c8aa8fed57e814085def7608ac65804"
+ end
+
+ resource "namespace::clean" do
+ url "https://cpan.metacpan.org/authors/id/R/RI/RIBASUSHI/namespace-clean-0.27.tar.gz"
+ sha256 "8a10a83c3e183dc78f9e7b7aa4d09b47c11fb4e7d3a33b9a12912fd22e31af9d"
end
def install
@@ -41,8 +176,9 @@ class Latexindent < Formula
resources.each do |r|
r.stage do
- system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}"
- system "make"
+ args = ["INSTALL_BASE=#{libexec}"]
+ args.unshift "--defaultdeps" if r.name == "MIME::Charset"
+ system "perl", "Makefile.PL", *args
system "make", "install"
end
end
class Latexindent < Formula
desc "Add indentation to LaTeX files"
homepage "https://ctan.org/pkg/latexindent"
url "https://github.com/cmhughes/latexindent.pl/archive/V3.8.2.tar.gz"
sha256 "a134e27d56b7daee2bea37563424f996fc559bc8019e92213261b25cdb84a688"
depends_on "perl"
resource "B::Hooks::EndOfScope" do
url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/B-Hooks-EndOfScope-0.24.tar.gz"
sha256 "03aa3dfe5d0aa6471a96f43fe8318179d19794d4a640708f0288f9216ec7acc6"
end
resource "Class::Data::Inheritable" do
url "https://cpan.metacpan.org/authors/id/T/TM/TMTM/Class-Data-Inheritable-0.08.tar.gz"
sha256 "9967feceea15227e442ec818723163eb6d73b8947e31f16ab806f6e2391af14a"
end
resource "Devel::GlobalDestruction" do
url "https://cpan.metacpan.org/authors/id/H/HA/HAARG/Devel-GlobalDestruction-0.14.tar.gz"
sha256 "34b8a5f29991311468fe6913cadaba75fd5d2b0b3ee3bb41fe5b53efab9154ab"
end
resource "Devel::StackTrace" do
url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Devel-StackTrace-2.04.tar.gz"
sha256 "cd3c03ed547d3d42c61fa5814c98296139392e7971c092e09a431f2c9f5d6855"
end
resource "Dist::CheckConflicts" do
url "https://cpan.metacpan.org/authors/id/D/DO/DOY/Dist-CheckConflicts-0.11.tar.gz"
sha256 "ea844b9686c94d666d9d444321d764490b2cde2f985c4165b4c2c77665caedc4"
end
resource "Eval::Closure" do
url "https://cpan.metacpan.org/authors/id/D/DO/DOY/Eval-Closure-0.14.tar.gz"
sha256 "ea0944f2f5ec98d895bef6d503e6e4a376fea6383a6bc64c7670d46ff2218cad"
end
resource "Exception::Class" do
url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Exception-Class-1.44.tar.gz"
sha256 "33f3fbf8b138d3b04ea4ec0ba83fb0df6ba898806bcf4ef393d4cafc1a23ee0d"
end
resource "File::HomeDir" do
url "https://cpan.metacpan.org/authors/id/R/RE/REHSACK/File-HomeDir-1.004.tar.gz"
sha256 "45f67e2bb5e60a7970d080e8f02079732e5a8dfc0c7c3cbdb29abfb3f9f791ad"
end
resource "File::Which" do
url "https://cpan.metacpan.org/authors/id/P/PL/PLICEASE/File-Which-1.23.tar.gz"
sha256 "b79dc2244b2d97b6f27167fc3b7799ef61a179040f3abd76ce1e0a3b0bc4e078"
end
resource "Log::Dispatch" do
url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Log-Dispatch-2.69.tar.gz"
sha256 "58624c0a0c4c620873efb7ce2f11dde55fa2e24c22be2551f548ff3624585277"
end
resource "Log::Log4perl" do
url "https://cpan.metacpan.org/authors/id/M/MS/MSCHILLI/Log-Log4perl-1.49.tar.gz"
sha256 "b739187f519146cb6bebcfc427c64b1f4138b35c5f4c96f46a21ed4a43872e16"
end
resource "MIME::Charset" do
url "https://cpan.metacpan.org/authors/id/N/NE/NEZUMI/MIME-Charset-1.012.2.tar.gz"
sha256 "878c779c0256c591666bd06c0cde4c0d7820eeeb98fd1183082aee9a1e7b1d13"
end
resource "MRO::Compat" do
url "https://cpan.metacpan.org/authors/id/H/HA/HAARG/MRO-Compat-0.13.tar.gz"
sha256 "8a2c3b6ccc19328d5579d02a7d91285e2afd85d801f49d423a8eb16f323da4f8"
end
resource "Mac::SystemDirectory" do
url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/Mac-SystemDirectory-0.13.tar.gz"
sha256 "8730740e4ff3ea4812139b0787dbd1b544e093a08218d908071629b70fde3684"
end
resource "Module::Build" do
url "https://cpan.metacpan.org/authors/id/L/LE/LEONT/Module-Build-0.4231.tar.gz"
sha256 "7e0f4c692c1740c1ac84ea14d7ea3d8bc798b2fb26c09877229e04f430b2b717"
end
resource "Module::Implementation" do
url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Module-Implementation-0.09.tar.gz"
sha256 "c15f1a12f0c2130c9efff3c2e1afe5887b08ccd033bd132186d1e7d5087fd66d"
end
resource "Module::Runtime" do
url "https://cpan.metacpan.org/authors/id/Z/ZE/ZEFRAM/Module-Runtime-0.016.tar.gz"
sha256 "68302ec646833547d410be28e09676db75006f4aa58a11f3bdb44ffe99f0f024"
end
resource "Package::Stash" do
url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/Package-Stash-0.38.tar.gz"
sha256 "c58ee8844df2dda38e3bf66fdf443439aaefaef1a33940edf2055f0afd223a7f"
end
resource "Package::Stash::XS" do
url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/Package-Stash-XS-0.29.tar.gz"
sha256 "d3676ba94641e03d6a30e951f09266c4c3ca3f5b58aa7b314a67f28e419878aa"
end
resource "Params::ValidationCompiler" do
url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Params-ValidationCompiler-0.30.tar.gz"
sha256 "dc5bee23383be42765073db284bed9fbd819d4705ad649c20b644452090d16cb"
end
resource "Role::Tiny" do
url "https://cpan.metacpan.org/authors/id/H/HA/HAARG/Role-Tiny-2.001004.tar.gz"
sha256 "92ba5712850a74102c93c942eb6e7f62f7a4f8f483734ed289d08b324c281687"
end
resource "Specio" do
url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Specio-0.46.tar.gz"
sha256 "0bf42aa116076d6efc18f72b72c7acb5638bd41c0aa09aecc12fc8bf9ceb9596"
end
resource "Sub::Exporter::Progressive" do
url "https://cpan.metacpan.org/authors/id/F/FR/FREW/Sub-Exporter-Progressive-0.001013.tar.gz"
sha256 "d535b7954d64da1ac1305b1fadf98202769e3599376854b2ced90c382beac056"
end
resource "Sub::Identify" do
url "https://cpan.metacpan.org/authors/id/R/RG/RGARCIA/Sub-Identify-0.14.tar.gz"
sha256 "068d272086514dd1e842b6a40b1bedbafee63900e5b08890ef6700039defad6f"
end
resource "Sub::Quote" do
url "https://cpan.metacpan.org/authors/id/H/HA/HAARG/Sub-Quote-2.006006.tar.gz"
sha256 "6e4e2af42388fa6d2609e0e82417de7cc6be47223f576592c656c73c7524d89d"
end
resource "Test::Fatal" do
url "https://cpan.metacpan.org/authors/id/R/RJ/RJBS/Test-Fatal-0.014.tar.gz"
sha256 "bcdcef5c7b2790a187ebca810b0a08221a63256062cfab3c3b98685d91d1cbb0"
end
resource "Try::Tiny" do
url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/Try-Tiny-0.30.tar.gz"
sha256 "da5bd0d5c903519bbf10bb9ba0cb7bcac0563882bcfe4503aee3fb143eddef6b"
end
resource "Unicode::LineBreak" do
url "https://cpan.metacpan.org/authors/id/N/NE/NEZUMI/Unicode-LineBreak-2019.001.tar.gz"
sha256 "486762e4cacddcc77b13989f979a029f84630b8175e7fef17989e157d4b6318a"
end
resource "Variable::Magic" do
url "https://cpan.metacpan.org/authors/id/V/VP/VPIT/Variable-Magic-0.62.tar.gz"
sha256 "3f9a18517e33f006a9c2fc4f43f01b54abfe6ff2eae7322424f31069296b615c"
end
resource "XString" do
url "https://cpan.metacpan.org/authors/id/A/AT/ATOOMIC/XString-0.002.tar.gz"
sha256 "260e252f7367228c9b4e43ef50c0becb04c4781de660577b3086cc106c0028c0"
end
resource "YAML::Tiny" do
url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/YAML-Tiny-1.73.tar.gz"
sha256 "bc315fa12e8f1e3ee5e2f430d90b708a5dc7e47c867dba8dce3a6b8fbe257744"
end
resource "namespace::autoclean" do
url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/namespace-autoclean-0.29.tar.gz"
sha256 "45ebd8e64a54a86f88d8e01ae55212967c8aa8fed57e814085def7608ac65804"
end
resource "namespace::clean" do
url "https://cpan.metacpan.org/authors/id/R/RI/RIBASUSHI/namespace-clean-0.27.tar.gz"
sha256 "8a10a83c3e183dc78f9e7b7aa4d09b47c11fb4e7d3a33b9a12912fd22e31af9d"
end
def install
ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5"
resources.each do |r|
r.stage do
args = ["INSTALL_BASE=#{libexec}"]
args.unshift "--defaultdeps" if r.name == "MIME::Charset"
system "perl", "Makefile.PL", *args
system "make", "install"
end
end
(libexec/"lib/perl5").install "LatexIndent"
(libexec/"bin").install "latexindent.pl"
(libexec/"bin").install "defaultSettings.yaml"
(bin/"latexindent").write_env_script("#{libexec}/bin/latexindent.pl", :PERL5LIB => ENV["PERL5LIB"])
end
test do
(testpath/"test.tex").write <<~EOS
\\documentclass{article}
\\title{latexindent Homebrew Test}
\\begin{document}
\\maketitle
\\begin{itemize}
\\item Hello
\\item World
\\end{itemize}
\\end{document}
EOS
assert_match <<~EOS, shell_output("#{bin}/latexindent #{testpath}/test.tex")
\\documentclass{article}
\\title{latexindent Homebrew Test}
\\begin{document}
\\maketitle
\\begin{itemize}
\\item Hello
\\item World
\\end{itemize}
\\end{document}
EOS
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment