homebrew-core/Formula/ford.rb

158 lines
7.0 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/30/49/683008b43febe29317da753a9509f6233e76c6bdef5ef9783f79d5dab4f2/FORD-6.1.15.tar.gz"
sha256 "d90000f528878738fc55f0f28aa34f36c5cb7f4819d851d10977f8499bf0cae6"
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_monterey: "ee520fddf80cbbe7a022d5d6abb7f1b727639353e498f704e8a830185c22067e"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "a048133d405c19af64a6c88a0404b5a5e3996c63bab7e7aa07731c570d853815"
sha256 cellar: :any_skip_relocation, monterey: "1d25115cedb3d8da14651279118e13a65eb1e605d2a5ad729b35af4a13cccba0"
sha256 cellar: :any_skip_relocation, big_sur: "51ebe44f105580423c9365bda73785072dfbc4c7fde90087aa8c4836a629d79a"
sha256 cellar: :any_skip_relocation, catalina: "bd9872a48e0c6b5b873b2fac23a0186d50d8abe164fca87abad4ff893c579676"
sha256 cellar: :any_skip_relocation, x86_64_linux: "7c618b7add70927e991acda3294d604f4db4c59b0a90339e2a78ae2f4b82bb3f"
end
depends_on "graphviz"
depends_on "python@3.10"
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/d6/58/79df20de6e67a83f0d0bbfe6c19bb82adf68cdf362885257eb01099f930a/Markdown-3.3.7.tar.gz"
sha256 "cbb516f16218e643d8e0a95b309f77eb118cb138d39a4f27851e6a63581db874"
end
resource "markdown-include" do
url "https://files.pythonhosted.org/packages/34/ce/289d5d459c274a59379f79af95f3f36ae29cb9d787206ad9b45dda48e3ce/markdown-include-0.6.0.tar.gz"
sha256 "6f5d680e36f7780c7f0f61dca53ca581bd50d1b56137ddcd6353efafa0c3e4a2"
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/98/2a/838de32e09bd511cf69fe4ae13ffc748ac143449bfc24bb3fd172d53a84f/tqdm-4.64.0.tar.gz"
sha256 "40be55d30e200777a307a7585aee69e4eabb46b4ec6a4b4a5f2d9f11e7d5408d"
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