PageRenderTime 41ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/Formula/ford.rb

https://gitlab.com/0072016/homebrew-core
Ruby | 153 lines | 132 code | 21 blank | 0 comment | 4 complexity | d46f9d24ad599c1aff6b59e250c27e23 MD5 | raw file
  1. class Ford < Formula
  2. desc "Automatic documentation generator for modern Fortran programs"
  3. homepage "https://github.com/cmacmackin/ford/"
  4. url "https://pypi.python.org/packages/85/11/7a70d720fcceddad67001dfa36bbc202d6172ba0b17e7d955db88516a33a/FORD-4.6.2.tar.gz"
  5. sha256 "48062d658c712e22e459d9a2460f7fd584013289a24d13e0fc011bdbe05c99b4"
  6. head "https://github.com/cmacmackin/ford.git"
  7. bottle do
  8. cellar :any_skip_relocation
  9. sha256 "d8671a9f6a080cddbadedf94d856d15eef6e27148ceab2dc8786e404c7c8af07" => :el_capitan
  10. sha256 "56a17d5091a0ed3f37c08770ce5a683546154a34defd156bd9ff65e56da7dda3" => :yosemite
  11. sha256 "60c7f77dc9eda0ab42debe1dd662603697cdec79df6009e2a964877c387e7c70" => :mavericks
  12. end
  13. option "without-lxml", "Do not install lxml to improve the speed of search database generation"
  14. depends_on "graphviz"
  15. depends_on :python if MacOS.version <= :snow_leopard
  16. resource "lxml" do
  17. url "https://pypi.python.org/packages/11/1b/fe6904151b37a0d6da6e60c13583945f8ce3eae8ebd0ec763ce546358947/lxml-3.6.0.tar.gz"
  18. sha256 "9c74ca28a7f0c30dca8872281b3c47705e21217c8bc63912d95c9e2a7cac6bdf"
  19. end
  20. resource "beautifulsoup4" do
  21. url "https://pypi.python.org/packages/26/79/ef9a8bcbec5abc4c618a80737b44b56f1cb393b40238574078c5002b97ce/beautifulsoup4-4.4.1.tar.gz"
  22. sha256 "87d4013d0625d4789a4f56b8d79a04d5ce6db1152bb65f1d39744f7709a366b4"
  23. end
  24. resource "graphviz" do
  25. url "https://pypi.python.org/packages/3d/6d/406cec4d782d3cd6cb02d90bb17fbd364cab4a2a96d8ad0b5ccb46fd7442/graphviz-0.4.10.zip"
  26. sha256 "61e9f7126f5efdd11fb9269d4622277fbf8ed92046b73f3e78529e3be6a95f15"
  27. end
  28. resource "Jinja2" do
  29. url "https://pypi.python.org/packages/f2/2f/0b98b06a345a761bec91a079ccae392d282690c2d8272e708f4d10829e22/Jinja2-2.8.tar.gz"
  30. sha256 "bc1ff2ff88dbfacefde4ddde471d1417d3b304e8df103a7a9437d47269201bf4"
  31. end
  32. resource "Markdown" do
  33. url "https://pypi.python.org/packages/9b/53/4492f2888408a2462fd7f364028b6c708f3ecaa52a028587d7dd729f40b4/Markdown-2.6.6.tar.gz"
  34. sha256 "9a292bb40d6d29abac8024887bcfc1159d7a32dc1d6f1f6e8d6d8e293666c504"
  35. end
  36. resource "markdown-include" do
  37. url "https://pypi.python.org/packages/ef/44/eb6e9b4fa1110b719abb876c9b6dd8b46af886a94536ec4e9117fe5e7b97/markdown-include-0.5.1.tar.gz"
  38. sha256 "72a45461b589489a088753893bc95c5fa5909936186485f4ed55caa57d10250f"
  39. end
  40. resource "MarkupSafe" do
  41. url "https://pypi.python.org/packages/c0/41/bae1254e0396c0cc8cf1751cb7d9afc90a602353695af5952530482c963f/MarkupSafe-0.23.tar.gz"
  42. sha256 "a4ec1aff59b95a14b45eb2e23761a0179e98319da5a7eb76b56ea8cdc7b871c3"
  43. end
  44. resource "Pygments" do
  45. url "https://pypi.python.org/packages/b8/67/ab177979be1c81bc99c8d0592ef22d547e70bb4c6815c383286ed5dec504/Pygments-2.1.3.tar.gz"
  46. sha256 "88e4c8a91b2af5962bfa5ea2447ec6dd357018e86e94c7d14bd8cacbc5b55d81"
  47. end
  48. resource "toposort" do
  49. url "https://pypi.python.org/packages/f6/f7/875e23067652488ae40603336fdd63510a1e1853672b5b829a78452fd31c/toposort-1.4.tar.gz"
  50. sha256 "c190b9d9a9e53ae2835f4d524130147af601fbd63677d19381c65067a80fa903"
  51. end
  52. def install
  53. ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages"
  54. deps = %w[beautifulsoup4 graphviz Jinja2 Markdown markdown-include MarkupSafe Pygments toposort]
  55. deps << "lxml" if build.with? "lxml"
  56. deps.each do |r|
  57. resource(r).stage do
  58. system "python", *Language::Python.setup_install_args(libexec/"vendor")
  59. end
  60. end
  61. ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python2.7/site-packages"
  62. system "python", *Language::Python.setup_install_args(libexec)
  63. bin.install Dir[libexec/"bin/*"]
  64. bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"])
  65. end
  66. test do
  67. (testpath/"test-project.md").write <<-EOS.undent
  68. project_dir: ./src
  69. output_dir: ./doc
  70. project_github: https://github.com/cmacmackin/futility
  71. project_website: https://github.com
  72. summary: Some Fortran program which I wrote.
  73. author: John Doe
  74. author_description: I program stuff in Fortran.
  75. github: https://github.com/cmacmackin
  76. email: john.doe@example.com
  77. predocmark: >
  78. docmark_alt: #
  79. predocmark_alt: <
  80. macro: TEST
  81. LOGIC=.true.
  82. This is a project which I wrote. This file will provide the documents. I'm
  83. writing the body of the text here. It contains an overall description of the
  84. project. It might explain how to go about installing/compiling it. It might
  85. provide a change-log for the code. Maybe it will talk about the history and/or
  86. motivation for this software.
  87. @Note
  88. You can include any notes (or bugs, warnings, or todos) like so.
  89. You can have as many paragraphs as you like here and can use headlines, links,
  90. images, etc. Basically, you can use anything in Markdown and Markdown-Extra.
  91. Furthermore, you can insert LaTeX into your documentation. So, for example,
  92. you can provide inline math using like \( y = x^2 \) or math on its own line
  93. like \[ x = \sqrt{y} \] or $$ e = mc^2. $$ You can even use LaTeX environments!
  94. So you can get numbered equations like this:
  95. \begin{equation}
  96. PV = nRT
  97. \end{equation}
  98. So let your imagination run wild. As you can tell, I'm more or less just
  99. filling in space now. This will be the last sentence.
  100. EOS
  101. mkdir testpath/"src" do
  102. (testpath/"src"/"ford_test_program.f90").write <<-EOS.undent
  103. program ford_test_program
  104. !! Simple Fortran program to demonstrate the usage of FORD and to test its installation
  105. use iso_fortran_env, only: output_unit, real64
  106. implicit none
  107. real (real64) :: global_pi = acos(-1)
  108. !! a global variable, initialized to the value of pi
  109. write(output_unit,'(A)') 'Small test program'
  110. call do_stuff(20)
  111. contains
  112. subroutine do_stuff(repeat)
  113. !! This is documentation for our subroutine that does stuff and things.
  114. !! This text is captured by ford
  115. integer, intent(in) :: repeat
  116. !! The number of times to repeatedly do stuff and things
  117. integer :: i
  118. !! internal loop counter
  119. ! the main content goes here and this is comment is not processed by FORD
  120. do i=1,repeat
  121. global_pi = acos(-1)
  122. end do
  123. end subroutine
  124. end program
  125. EOS
  126. end
  127. system "#{bin}/ford", testpath/"test-project.md"
  128. assert File.exist?(testpath/"doc"/"index.html")
  129. end
  130. end