Move interactive from GitHubPages to Documenter, fix up some docs

This commit is contained in:
Chris de Graaf 2017-08-28 22:34:34 +01:00
parent 0992baeb87
commit ef7fa94a98
3 changed files with 16 additions and 16 deletions

View File

@ -46,7 +46,7 @@ function gen_plugin(
pages=[ pages=[
"Home" => "index.md", "Home" => "index.md",
], ],
repo="https://github.com/$(template.user)/$pkg_name.jl/blob/{commit}{path}#L{line}", repo="https://$(template.host)/$(template.user)/$pkg_name.jl/blob/{commit}{path}#L{line}",
sitename="$pkg_name.jl", sitename="$pkg_name.jl",
authors="$(template.authors)", authors="$(template.authors)",
assets=$assets_string, assets=$assets_string,
@ -62,3 +62,9 @@ function gen_plugin(
cp(readme_path, joinpath(docs_dir, "index.md"), remove_destination=true) cp(readme_path, joinpath(docs_dir, "index.md"), remove_destination=true)
end end
end end
function interactive(plugin_type::Type{<:Documenter})
plugin_name = split(string(plugin_type), ".")[end]
print("Enter any Documenter asset files for $plugin_name (separated by spaces) []: ")
return plugin_type(; assets=String.(split(readline())))
end

View File

@ -1,5 +1,5 @@
""" """
GitHubPages(; assets::Vector{AbstractString}=String[]) -> GitHubPages GitHubPages(; assets::Vector{<:AbstractString}=String[]) -> GitHubPages
Add `GitHubPages` to a template's plugins to add [Documenter](@ref) support via GitHub Add `GitHubPages` to a template's plugins to add [Documenter](@ref) support via GitHub
Pages, including automatic uploading of documentation from [`TravisCI`](@ref). Also Pages, including automatic uploading of documentation from [`TravisCI`](@ref). Also
@ -12,7 +12,7 @@ adds appropriate badges to the README, and updates the `.gitignore` accordingly.
gitignore::Vector{AbstractString} gitignore::Vector{AbstractString}
assets::Vector{AbstractString} assets::Vector{AbstractString}
function GitHubPages(; assets::Vector{String}=String[]) function GitHubPages(; assets::Vector{<:AbstractString}=String[])
for file in assets for file in assets
if !isfile(file) if !isfile(file)
throw(ArgumentError("Asset file $(abspath(file)) does not exist")) throw(ArgumentError("Asset file $(abspath(file)) does not exist"))
@ -68,8 +68,3 @@ function gen_plugin(
end end
return ["docs/"] return ["docs/"]
end end
function interactive(plugin_type::Type{GitHubPages})
print("Enter any Documenter asset files for GitHubPages (separated by spaces) []: ")
return GitHubPages(; assets=String.(split(readline())))
end

View File

@ -19,7 +19,7 @@ create a template, you can use [`interactive_template`](@ref) instead.
available licenses, and [`show_license`](@ref) can be used to print out a particular available licenses, and [`show_license`](@ref) can be used to print out a particular
license's text. license's text.
* `authors::Union{AbstractString, Vector{<:AbstractString}}=""`: Names that appear on the * `authors::Union{AbstractString, Vector{<:AbstractString}}=""`: Names that appear on the
license. Supply a string for one author, and an array for multiple. Similarly to `user`, license. Supply a string for one author or an array for multiple. Similarly to `user`,
it will try to take the value of a supplied git config's "user.name" key, then the global it will try to take the value of a supplied git config's "user.name" key, then the global
git config's value, if it is left unset. git config's value, if it is left unset.
* `years::Union{Integer, AbstractString}=Dates.year(Dates.today())`: Copyright years on the * `years::Union{Integer, AbstractString}=Dates.year(Dates.today())`: Copyright years on the
@ -27,13 +27,12 @@ create a template, you can use [`interactive_template`](@ref) instead.
* `dir::AbstractString=Pkg.dir()`: Directory in which the package will go. Relative paths * `dir::AbstractString=Pkg.dir()`: Directory in which the package will go. Relative paths
are converted to absolute ones at template creation time. are converted to absolute ones at template creation time.
* `julia_version::VersionNumber=VERSION`: Minimum allowed Julia version. * `julia_version::VersionNumber=VERSION`: Minimum allowed Julia version.
* `requirements::Vector{String}=String[]`: Package requirements. If there are duplicate * `requirements::Vector{<:AbstractString}=String[]`: Package requirements. If there are
requirements with different versions, i.e. ["PkgTemplates", "PkgTemplates 0.1"], duplicate requirements with different versions, i.e. ["PkgTemplates", "PkgTemplates
an `ArgumentError` is thrown. 0.1"], an `ArgumentError` is thrown. Each entry in this array will be copied into the
Each entry in this array will be copied into the `REQUIRE` file of packages generated `REQUIRE` file of packages generated with this template.
with this template. * `gitconfig::Dict=Dict()`: Git configuration options.
* `gitconfig::Dict{String, String}=Dict{String, String}()`: Git configuration options. * `plugins::Vector{<:Plugin}=Plugin[]`: A list of `Plugin`s that the package will include.
* `plugins::Plugin[]`: A list of `Plugin`s that the package will include.
""" """
@auto_hash_equals struct Template @auto_hash_equals struct Template
user::AbstractString user::AbstractString