Replace Void/Nullables
This commit is contained in:
parent
f070978334
commit
632283b847
@ -2,6 +2,8 @@ __precompile__()
|
||||
module PkgTemplates
|
||||
|
||||
using AutoHashEquals
|
||||
using Dates
|
||||
using Distributed
|
||||
using Mustache
|
||||
using TerminalMenus
|
||||
using URIParser
|
||||
|
@ -7,7 +7,7 @@ Generic plugins are plugins that add any number of patterns to the generated pac
|
||||
# Attributes
|
||||
* `gitignore::Vector{AbstractString}`: Array of patterns to be added to the `.gitignore` of
|
||||
generated packages that use this plugin.
|
||||
* `src::Nullable{AbstractString}`: Path to the file that will be copied into the generated
|
||||
* `src::Union{AbstractString, Nothing}`: Path to the file that will be copied into the generated
|
||||
package repository. If set to `nothing`, no file will be generated. When this defaults
|
||||
to an empty string, there should be a default file in `defaults` that will be copied.
|
||||
That file's name is usually the same as the plugin's name, except in all lowercase and
|
||||
@ -25,7 +25,7 @@ Generic plugins are plugins that add any number of patterns to the generated pac
|
||||
```julia
|
||||
@auto_hash_equals struct MyPlugin <: GenericPlugin
|
||||
gitignore::Vector{AbstractString}
|
||||
src::Nullable{AbstractString}
|
||||
src::Union{AbstractString, Nothing}
|
||||
dest::AbstractString
|
||||
badges::Vector{Badge}
|
||||
view::Dict{String, Any}
|
||||
|
@ -1,21 +1,21 @@
|
||||
"""
|
||||
AppVeyor(; config_file::Union{AbstractString, Void}="") -> AppVeyor
|
||||
AppVeyor(; config_file::Union{AbstractString, Nothing}="") -> AppVeyor
|
||||
|
||||
Add `AppVeyor` to a template's plugins to add a `.appveyor.yml` configuration file to
|
||||
generated repositories, and an appropriate badge to the README.
|
||||
|
||||
# Keyword Arguments
|
||||
* `config_file::Union{AbstractString, Void}=""`: Path to a custom `.appveyor.yml`.
|
||||
* `config_file::Union{AbstractString, Nothing}=""`: Path to a custom `.appveyor.yml`.
|
||||
If `nothing` is supplied, no file will be generated.
|
||||
"""
|
||||
@auto_hash_equals struct AppVeyor <: GenericPlugin
|
||||
gitignore::Vector{AbstractString}
|
||||
src::Nullable{AbstractString}
|
||||
src::Union{AbstractString, Nothing}
|
||||
dest::AbstractString
|
||||
badges::Vector{Badge}
|
||||
view::Dict{String, Any}
|
||||
|
||||
function AppVeyor(; config_file::Union{AbstractString, Void}="")
|
||||
function AppVeyor(; config_file::Union{AbstractString, Nothing}="")
|
||||
if config_file != nothing
|
||||
config_file = if isempty(config_file)
|
||||
config_file = joinpath(DEFAULTS_DIR, "appveyor.yml")
|
||||
|
@ -1,22 +1,22 @@
|
||||
"""
|
||||
CodeCov(; config_file::Union{AbstractString, Void}=nothing) -> CodeCov
|
||||
CodeCov(; config_file::Union{AbstractString, Nothing}=nothing) -> CodeCov
|
||||
|
||||
Add `CodeCov` to a template's plugins to optionally add a `.codecov.yml` configuration file
|
||||
to generated repositories, and an appropriate badge to the README. Also updates the
|
||||
`.gitignore` accordingly.
|
||||
|
||||
# Keyword Arguments:
|
||||
* `config_file::Union{AbstractString, Void}=nothing`: Path to a custom `.codecov.yml`.
|
||||
* `config_file::Union{AbstractString, Nothing}=nothing`: Path to a custom `.codecov.yml`.
|
||||
If left unset, no file will be generated.
|
||||
"""
|
||||
@auto_hash_equals struct CodeCov <: GenericPlugin
|
||||
gitignore::Vector{AbstractString}
|
||||
src::Nullable{AbstractString}
|
||||
src::Union{AbstractString, Nothing}
|
||||
dest::AbstractString
|
||||
badges::Vector{Badge}
|
||||
view::Dict{String, Any}
|
||||
|
||||
function CodeCov(; config_file::Union{AbstractString, Void}=nothing)
|
||||
function CodeCov(; config_file::Union{AbstractString, Nothing}=nothing)
|
||||
if config_file != nothing
|
||||
config_file = if isfile(config_file)
|
||||
abspath(config_file)
|
||||
|
@ -1,22 +1,22 @@
|
||||
"""
|
||||
Coveralls(; config_file::Union{AbstractString, Void}=nothing) -> Coveralls
|
||||
Coveralls(; config_file::Union{AbstractString, Nothing}=nothing) -> Coveralls
|
||||
|
||||
Add `Coveralls` to a template's plugins to optionally add a `.coveralls.yml` configuration
|
||||
file to generated repositories, and an appropriate badge to the README. Also updates the
|
||||
`.gitignore` accordingly.
|
||||
|
||||
# Keyword Arguments:
|
||||
* `config_file::Union{AbstractString, Void}=nothing`: Path to a custom `.coveralls.yml`.
|
||||
* `config_file::Union{AbstractString, Nothing}=nothing`: Path to a custom `.coveralls.yml`.
|
||||
If left unset, no file will be generated.
|
||||
"""
|
||||
@auto_hash_equals struct Coveralls <: GenericPlugin
|
||||
gitignore::Vector{AbstractString}
|
||||
src::Nullable{AbstractString}
|
||||
src::Union{AbstractString, Nothing}
|
||||
dest::AbstractString
|
||||
badges::Vector{Badge}
|
||||
view::Dict{String, Any}
|
||||
|
||||
function Coveralls(; config_file::Union{AbstractString, Void}=nothing)
|
||||
function Coveralls(; config_file::Union{AbstractString, Nothing}=nothing)
|
||||
if config_file != nothing
|
||||
config_file = if isfile(config_file)
|
||||
abspath(config_file)
|
||||
|
@ -25,12 +25,12 @@ function gen_plugin(
|
||||
# assets/file1,
|
||||
# assets/file2,
|
||||
# ]
|
||||
const TAB = repeat(" ", 4)
|
||||
tab = repeat(" ", 4)
|
||||
assets_string = "[\n"
|
||||
for asset in plugin.assets
|
||||
assets_string *= """$(TAB^2)"assets/$(basename(asset))",\n"""
|
||||
assets_string *= """$(tab^2)"assets/$(basename(asset))",\n"""
|
||||
end
|
||||
assets_string *= "$TAB]"
|
||||
assets_string *= "$tab]"
|
||||
|
||||
else
|
||||
assets_string = "[]"
|
||||
|
@ -1,23 +1,23 @@
|
||||
"""
|
||||
GitLabCI(; config_file::Union{AbstractString, Void}="", coverage::Bool=true) -> GitLabCI
|
||||
GitLabCI(; config_file::Union{AbstractString, Nothing}="", coverage::Bool=true) -> GitLabCI
|
||||
|
||||
Add `GitLabCI` to a template's plugins to add a `.gitlab-ci.yml` configuration file to
|
||||
generated repositories, and appropriate badge(s) to the README.
|
||||
|
||||
# Keyword Arguments:
|
||||
* `config_file::Union{AbstractString, Void}=""`: Path to a custom `.gitlab-ci.yml`.
|
||||
* `config_file::Union{AbstractString, Nothing}=""`: Path to a custom `.gitlab-ci.yml`.
|
||||
If `nothing` is supplied, no file will be generated.
|
||||
* `coverage::Bool=true`: Whether or not GitLab CI's built-in code coverage analysis should
|
||||
be enabled.
|
||||
"""
|
||||
@auto_hash_equals struct GitLabCI <: GenericPlugin
|
||||
gitignore::Vector{AbstractString}
|
||||
src::Nullable{AbstractString}
|
||||
src::Union{AbstractString, Nothing}
|
||||
dest::AbstractString
|
||||
badges::Vector{Badge}
|
||||
view::Dict{String, Any}
|
||||
|
||||
function GitLabCI(; config_file::Union{AbstractString, Void}="", coverage::Bool=true)
|
||||
function GitLabCI(; config_file::Union{AbstractString, Nothing}="", coverage::Bool=true)
|
||||
if config_file != nothing
|
||||
config_file = if isempty(config_file)
|
||||
config_file = joinpath(DEFAULTS_DIR, "gitlab-ci.yml")
|
||||
|
@ -1,21 +1,21 @@
|
||||
"""
|
||||
TravisCI(; config_file::Union{AbstractString, Void}="") -> TravisCI
|
||||
TravisCI(; config_file::Union{AbstractString, Nothing}="") -> TravisCI
|
||||
|
||||
Add `TravisCI` to a template's plugins to add a `.travis.yml` configuration file to
|
||||
generated repositories, and an appropriate badge to the README.
|
||||
|
||||
# Keyword Arguments:
|
||||
* `config_file::Union{AbstractString, Void}=""`: Path to a custom `.travis.yml`.
|
||||
* `config_file::Union{AbstractString, Nothing}=""`: Path to a custom `.travis.yml`.
|
||||
If `nothing` is supplied, no file will be generated.
|
||||
"""
|
||||
@auto_hash_equals struct TravisCI <: GenericPlugin
|
||||
gitignore::Vector{AbstractString}
|
||||
src::Nullable{AbstractString}
|
||||
src::Union{AbstractString, Nothing}
|
||||
dest::AbstractString
|
||||
badges::Vector{Badge}
|
||||
view::Dict{String, Any}
|
||||
|
||||
function TravisCI(; config_file::Union{AbstractString, Void}="")
|
||||
function TravisCI(; config_file::Union{AbstractString, Nothing}="")
|
||||
if config_file != nothing
|
||||
config_file = if isempty(config_file)
|
||||
config_file = joinpath(DEFAULTS_DIR, "travis.yml")
|
||||
|
Loading…
Reference in New Issue
Block a user