PkgTemplates.jl/src/plugins/codecov.jl

44 lines
1.5 KiB
Julia
Raw Normal View History

2017-08-11 22:18:09 +00:00
"""
2018-09-17 19:40:09 +00:00
CodeCov(; config_file::Union{AbstractString, Nothing}=nothing) -> CodeCov
2017-08-11 22:18:09 +00:00
2017-10-27 15:47:56 +00:00
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.
2017-08-11 22:18:09 +00:00
# Keyword Arguments:
2018-09-17 19:40:09 +00:00
* `config_file::Union{AbstractString, Nothing}=nothing`: Path to a custom `.codecov.yml`.
2017-10-27 15:47:56 +00:00
If left unset, no file will be generated.
2017-08-11 22:18:09 +00:00
"""
@auto_hash_equals struct CodeCov <: GenericPlugin
gitignore::Vector{AbstractString}
2018-09-17 19:40:09 +00:00
src::Union{AbstractString, Nothing}
dest::AbstractString
2017-08-18 04:06:15 +00:00
badges::Vector{Badge}
view::Dict{String, Any}
2017-08-11 22:18:09 +00:00
2018-09-17 19:40:09 +00:00
function CodeCov(; config_file::Union{AbstractString, Nothing}=nothing)
if config_file != nothing
2017-10-27 15:47:56 +00:00
config_file = if isfile(config_file)
2017-10-02 04:26:02 +00:00
abspath(config_file)
else
throw(ArgumentError("File $(abspath(config_file)) does not exist"))
end
2017-08-11 22:18:09 +00:00
end
new(
["*.jl.cov", "*.jl.*.cov", "*.jl.mem"],
config_file,
".codecov.yml",
[
2017-08-18 04:06:15 +00:00
Badge(
"CodeCov",
"https://codecov.io/gh/{{USER}}/{{PKGNAME}}.jl/branch/master/graph/badge.svg",
"https://codecov.io/gh/{{USER}}/{{PKGNAME}}.jl",
2017-08-18 04:06:15 +00:00
),
],
Dict{String, Any}(),
)
end
2017-08-11 22:18:09 +00:00
end
2017-10-27 15:47:56 +00:00
interactive(plugin_type::Type{CodeCov}) = interactive(plugin_type; file=nothing)