homebrew-core/Formula/ford.rb

161 lines
7.3 KiB
Ruby

class Ford < Formula
include Language::Python::Virtualenv
desc "Automatic documentation generator for modern Fortran programs"
homepage "https://github.com/Fortran-FOSS-Programmers/ford"
url "https://files.pythonhosted.org/packages/14/89/156df5d59836a39a5d11d65f81135d0338a33023188ff8aa5e7b29764919/FORD-6.1.17.tar.gz"
sha256 "10f8cc19517ea6b8308251e59286a793c9bc47098c33da3528aca16a08143908"
license "GPL-3.0-or-later"
head "https://github.com/Fortran-FOSS-Programmers/ford.git", branch: "master"
bottle do
sha256 cellar: :any_skip_relocation, arm64_ventura: "293fa584b1cb58340f1eedf51ec8bed77cde2ee1510b0e033172f4e8a5ac059b"
sha256 cellar: :any_skip_relocation, arm64_monterey: "17223b93b09b2c55907b63f0bf10ecbcbe3c8c8eb3ad3f613a8900ef7786c95a"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "36fe3fc113050595e8aec53cf4af937b4bfdb4bda034492b34e6eb51126c0ede"
sha256 cellar: :any_skip_relocation, ventura: "cf807db6995c308a486aefdfee4ed1b712b9af63f654ee8e47799dd324587f02"
sha256 cellar: :any_skip_relocation, monterey: "75687c3aa866ec1c93119ac3a4279fc5e5ec7dc136688d6f1d9d8eb73d0dd21d"
sha256 cellar: :any_skip_relocation, big_sur: "28c8d7b6db281d2f4c7870567226d15ac71d48df3fa91fa298eb1d4ca6f5fa9a"
sha256 cellar: :any_skip_relocation, catalina: "f5d1c31c54375c2d48ae50310e1fa87850732fad5bd7e77c255a966c6710a04f"
sha256 cellar: :any_skip_relocation, x86_64_linux: "19504bb39904011a6d09d4cef63c810ead970f458aa22a2b4c82a12abc4db809"
end
depends_on "graphviz"
depends_on "python@3.11"
uses_from_macos "libxml2"
uses_from_macos "libxslt"
resource "beautifulsoup4" do
url "https://files.pythonhosted.org/packages/e8/b0/cd2b968000577ec5ce6c741a54d846dfa402372369b8b6861720aa9ecea7/beautifulsoup4-4.11.1.tar.gz"
sha256 "ad9aa55b65ef2808eb405f46cf74df7fcb7044d5cbc26487f96eb2ef2e436693"
end
resource "graphviz" do
url "https://files.pythonhosted.org/packages/a5/90/fb047ce95c1eadde6ae78b3fca6a598b4c307277d4f8175d12b18b8f7321/graphviz-0.20.1.zip"
sha256 "8c58f14adaa3b947daf26c19bc1e98c4e0702cdc31cf99153e6f06904d492bf8"
end
resource "Jinja2" do
url "https://files.pythonhosted.org/packages/7a/ff/75c28576a1d900e87eb6335b063fab47a8ef3c8b4d88524c4bf78f670cce/Jinja2-3.1.2.tar.gz"
sha256 "31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852"
end
resource "Markdown" do
url "https://files.pythonhosted.org/packages/85/7e/133e943e97a943d2f1d8bae0c5060f8ac50e6691754eb9dbe036b047a9bb/Markdown-3.4.1.tar.gz"
sha256 "3b809086bb6efad416156e00a0da66fe47618a5d6918dd688f53f40c8e4cfeff"
end
# upstream issue with pypi artifact, https://github.com/cmacmackin/markdown-include/issues/35
resource "markdown-include" do
url "https://github.com/cmacmackin/markdown-include/archive/refs/tags/v0.7.0.tar.gz"
sha256 "5944cac326e3f071188ce902c6edeacbf5ae7c33273875594debf93e5d850a72"
end
resource "MarkupSafe" do
url "https://files.pythonhosted.org/packages/1d/97/2288fe498044284f39ab8950703e88abbac2abbdf65524d576157af70556/MarkupSafe-2.1.1.tar.gz"
sha256 "7f91197cc9e48f989d12e4e6fbc46495c446636dfc81b9ccf50bb0ec74b91d4b"
end
resource "Pygments" do
url "https://files.pythonhosted.org/packages/59/0f/eb10576eb73b5857bc22610cdfc59e424ced4004fe7132c8f2af2cc168d3/Pygments-2.12.0.tar.gz"
sha256 "5eb116118f9612ff1ee89ac96437bb6b49e8f04d8a13b514ba26f620208e26eb"
end
resource "python-markdown-math" do
url "https://files.pythonhosted.org/packages/ec/17/e7e3f3fce951b8adec10987834f4b2fa721ebd9bd6651ce2a4f39c4c544d/python-markdown-math-0.8.tar.gz"
sha256 "8564212af679fc18d53f38681f16080fcd3d186073f23825c7ce86fadd3e3635"
end
resource "soupsieve" do
url "https://files.pythonhosted.org/packages/f3/03/bac179d539362319b4779a00764e95f7542f4920084163db6b0fd4742d38/soupsieve-2.3.2.post1.tar.gz"
sha256 "fc53893b3da2c33de295667a0e19f078c14bf86544af307354de5fcf12a3f30d"
end
resource "toposort" do
url "https://files.pythonhosted.org/packages/b2/be/67bec9a73041616dd359f06e997d56c9c99d252460a3f035411d97c96c48/toposort-1.7.tar.gz"
sha256 "ddc2182c42912a440511bd7ff5d3e6a1cabc3accbc674a3258c8c41cbfbb2125"
end
resource "tqdm" do
url "https://files.pythonhosted.org/packages/c1/c2/d8a40e5363fb01806870e444fc1d066282743292ff32a9da54af51ce36a2/tqdm-4.64.1.tar.gz"
sha256 "5f4f682a004951c1b450bc753c710e9280c5746ce6ffedee253ddbcbf54cf1e4"
end
def install
virtualenv_install_with_resources
doc.install "2008standard.pdf", "2003standard.pdf"
pkgshare.install "example/example-project-file.md"
end
test do
(testpath/"test-project.md").write <<~EOS
project_dir: ./src
output_dir: ./doc
project_github: https://github.com/cmacmackin/futility
project_website: https://github.com
summary: Some Fortran program which I wrote.
author: John Doe
author_description: I program stuff in Fortran.
github: https://github.com/cmacmackin
email: john.doe@example.com
predocmark: >
docmark_alt: #
predocmark_alt: <
macro: TEST
LOGIC=.true.
This is a project which I wrote. This file will provide the documents. I'm
writing the body of the text here. It contains an overall description of the
project. It might explain how to go about installing/compiling it. It might
provide a change-log for the code. Maybe it will talk about the history and/or
motivation for this software.
@Note
You can include any notes (or bugs, warnings, or todos) like so.
You can have as many paragraphs as you like here and can use headlines, links,
images, etc. Basically, you can use anything in Markdown and Markdown-Extra.
Furthermore, you can insert LaTeX into your documentation. So, for example,
you can provide inline math using like ( y = x^2 ) or math on its own line
like [ x = \sqrt{y} ] or $$ e = mc^2. $$ You can even use LaTeX environments!
So you can get numbered equations like this:
\begin{equation}
PV = nRT
\end{equation}
So let your imagination run wild. As you can tell, I'm more or less just
filling in space now. This will be the last sentence.
EOS
mkdir testpath/"src" do
(testpath/"src"/"ford_test_program.f90").write <<~EOS
program ford_test_program
!! Simple Fortran program to demonstrate the usage of FORD and to test its installation
use iso_fortran_env, only: output_unit, real64
implicit none
real (real64) :: global_pi = acos(-1)
!! a global variable, initialized to the value of pi
write(output_unit,'(A)') 'Small test program'
call do_stuff(20)
contains
subroutine do_stuff(repeat)
!! This is documentation for our subroutine that does stuff and things.
!! This text is captured by ford
integer, intent(in) :: repeat
!! The number of times to repeatedly do stuff and things
integer :: i
!! internal loop counter
! the main content goes here and this is comment is not processed by FORD
do i=1,repeat
global_pi = acos(-1)
end do
end subroutine
end program
EOS
end
system bin/"ford", testpath/"test-project.md"
assert_predicate testpath/"doc"/"index.html", :exist?
end
end