Files
JuliaFEM.jl/docs/build_api.jl
T

68 lines
2.1 KiB
Julia
Raw Normal View History

2015-06-26 18:44:20 +03:00
using Docile, Lexicon, JuliaFEM
const api_directory = "api"
const modules = [JuliaFEM, JuliaFEM.elasticity_solver]
2015-06-26 19:53:42 +03:00
# main_folder = dirname(dirname(@__FILE__))
# this_folder = dirname(@__FILE__)
2015-06-26 19:33:49 +03:00
2015-06-26 19:53:42 +03:00
# file_ = "README.md"
# run(`cp $main_folder/$file_ $this_folder`)
2015-06-26 19:33:49 +03:00
2015-06-26 18:44:20 +03:00
cd(dirname(@__FILE__)) do
2015-06-26 20:10:47 +03:00
# Run the doctests *before* we start to generate *any* documentation.
for m in modules
failures = failed(doctest(m))
if !isempty(failures.results)
println("\nDoctests failed, aborting commit.\n")
display(failures)
exit(1) # Bail when doctests fail.
end
end
2015-06-26 18:44:20 +03:00
# Generate and save the contents of docstrings as markdown files.
index = Index()
for mod in modules
Lexicon.update!(index, save(joinpath(api_directory, "$(mod).md"), mod))
end
save(joinpath(api_directory, "index.md"), index; md_subheader = :category)
# Add a reminder not to edit the generated files.
2015-06-26 18:58:44 +03:00
open(joinpath(api_directory, "README.md"), "w") do f
2015-06-26 18:44:20 +03:00
print(f, """
Files in this directory are generated using the `build.jl` script. Make
all changes to the originating docstrings/files rather than these ones.
""")
end
2015-07-03 22:32:20 +03:00
# info("Adding all documentation changes in $(api_directory) to this commit.")
# success(`git add $(api_directory)`) || exit(1)
2015-06-26 18:44:20 +03:00
end
2015-07-04 22:06:29 +03:00
# point of this?
cd(dirname(dirname(@__FILE__))) do
yaml = """
# This is automatically generated by docs/build.jl. Edit that file if you
# wish to make any permenant changes.
site_name: JuliaFEM.jl
site_description: JuliaFEM.jl, open-source software for reliable, scalable, distributed Finite Element Method.
repo_name: GitHub
2015-07-04 22:37:25 +03:00
# docs_dir: 'docs'
# site_dir: 'site'
2015-07-04 22:06:29 +03:00
repo_url: https://github.com/JuliaFEM/JuliaFEM.jl
pages:
2015-07-04 22:37:25 +03:00
- Home: 'index.md'
#- API Docs:
- JuliaFEM: 'api/JuliaFEM.md'
- JuliaFEM.elasticity_solver: 'api/JuliaFEM.elasticity_solver.md'
theme: readthedocs
2015-07-04 22:06:29 +03:00
"""
# TODO: add the solutions if I figure out how to get them to render properly
open("mkdocs.yml", "w") do f
write(f, yaml)
end
end