Add GitLabPages plugin
This commit is contained in:
parent
27fe02ac82
commit
d209823a57
@ -6,3 +6,21 @@ Julia {{VERSION}}:
|
||||
after_script:
|
||||
- julia -e 'using Printf; using Pkg; Pkg.add("Coverage"); using Coverage; c, t = get_summary(process_folder()); @printf "Test Coverage %.2f%%\n" 100c/t'
|
||||
{{/GITLABCOVERAGE}}
|
||||
{{#DOCUMENTER}}
|
||||
Documentation:
|
||||
image: julia:{{VERSION}}
|
||||
stage: deploy
|
||||
script:
|
||||
- julia --project=docs -e '
|
||||
using Pkg;
|
||||
Pkg.develop(PackageSpec(path=pwd()));
|
||||
Pkg.instantiate();
|
||||
include("docs/make.jl");'
|
||||
- mkdir -p public
|
||||
- mv docs/build public/dev
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
only:
|
||||
- master
|
||||
{{/DOCUMENTER}}
|
||||
|
@ -19,6 +19,7 @@ export
|
||||
available_licenses,
|
||||
# Plugins.
|
||||
GitHubPages,
|
||||
GitLabPages,
|
||||
AppVeyor,
|
||||
TravisCI,
|
||||
GitLabCI,
|
||||
@ -42,8 +43,9 @@ include(joinpath("plugins", "codecov.jl"))
|
||||
include(joinpath("plugins", "travisci.jl"))
|
||||
include(joinpath("plugins", "gitlabci.jl"))
|
||||
include(joinpath("plugins", "githubpages.jl"))
|
||||
include(joinpath("plugins", "gitlabpages.jl"))
|
||||
|
||||
const DEFAULTS_DIR = normpath(joinpath(@__DIR__, "..", "defaults"))
|
||||
const BADGE_ORDER = [GitHubPages, TravisCI, AppVeyor, GitLabCI, Codecov, Coveralls]
|
||||
const BADGE_ORDER = [GitHubPages, GitLabPages, TravisCI, AppVeyor, GitLabCI, Codecov, Coveralls]
|
||||
|
||||
end
|
||||
|
51
src/plugins/gitlabpages.jl
Normal file
51
src/plugins/gitlabpages.jl
Normal file
@ -0,0 +1,51 @@
|
||||
"""
|
||||
GitLabPages(; assets::Vector{<:AbstractString}=String[]) -> GitLabPages
|
||||
|
||||
Add `GitLabPages` to a template's plugins to add [`Documenter`](@ref) support via GitLab
|
||||
Pages, including automatic uploading of documentation from [`GitLabCI`](@ref). Also
|
||||
adds appropriate badges to the README, and updates the `.gitignore` accordingly.
|
||||
|
||||
# Keyword Arguments
|
||||
* `assets::Vector{<:AbstractString}=String[]`: Array of paths to Documenter asset files.
|
||||
"""
|
||||
struct GitLabPages <: Documenter
|
||||
gitignore::Vector{String}
|
||||
assets::Vector{String}
|
||||
|
||||
function GitLabPages(; assets::Vector{<:AbstractString}=String[])
|
||||
for file in assets
|
||||
if !isfile(file)
|
||||
throw(ArgumentError("Asset file $(abspath(file)) does not exist"))
|
||||
end
|
||||
end
|
||||
# Windows Git recognizes these paths as well.
|
||||
new(["/docs/build/", "/docs/site/"], abspath.(assets))
|
||||
end
|
||||
end
|
||||
|
||||
function badges(::GitLabPages, user::AbstractString, pkg_name::AbstractString)
|
||||
return [
|
||||
#=
|
||||
format(Badge(
|
||||
"Stable",
|
||||
"https://img.shields.io/badge/docs-stable-blue.svg",
|
||||
"https://$user.gitlab.io/$pkg_name.jl/stable"
|
||||
)),
|
||||
=#
|
||||
format(Badge(
|
||||
"Dev",
|
||||
"https://img.shields.io/badge/docs-dev-blue.svg",
|
||||
"https://$user.gitlab.io/$pkg_name.jl/dev"
|
||||
)),
|
||||
]
|
||||
end
|
||||
|
||||
function gen_plugin(p::GitLabPages, t::Template, pkg_name::AbstractString)
|
||||
invoke(gen_plugin, Tuple{Documenter, Template, AbstractString}, p, t, pkg_name)
|
||||
return ["docs/"]
|
||||
end
|
||||
|
||||
function interactive(::Type{GitLabPages})
|
||||
print("GitLabPages: Enter any Documenter asset files (separated by spaces) []: ")
|
||||
return GitLabPages(; assets=string.(split(readline())))
|
||||
end
|
Loading…
Reference in New Issue
Block a user