Use Parameters.with_kw instead of kwdef for 1.0 compat

This commit is contained in:
Chris de Graaf 2019-08-26 22:24:49 +07:00
parent 9dedf9109c
commit cfed5fc7e6
No known key found for this signature in database
GPG Key ID: 150FFDD9B0073C7B
7 changed files with 28 additions and 12 deletions

View File

@ -53,6 +53,18 @@ git-tree-sha1 = "f39de3a12232eb47bd0629b3a661054287780276"
uuid = "ffc61752-8dc7-55ee-8c37-f3e9cdd09e70" uuid = "ffc61752-8dc7-55ee-8c37-f3e9cdd09e70"
version = "0.5.13" version = "0.5.13"
[[OrderedCollections]]
deps = ["Random", "Serialization", "Test"]
git-tree-sha1 = "c4c13474d23c60d20a67b217f1d7f22a40edf8f1"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.1.0"
[[Parameters]]
deps = ["OrderedCollections"]
git-tree-sha1 = "1dfd7cd50a8eb06ef693a4c2bbe945943cd000c5"
uuid = "d96e819e-fc66-5662-9728-84c9c7592b0a"
version = "0.11.0"
[[Pkg]] [[Pkg]]
deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"] deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

View File

@ -8,6 +8,7 @@ Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433" LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
Mustache = "ffc61752-8dc7-55ee-8c37-f3e9cdd09e70" Mustache = "ffc61752-8dc7-55ee-8c37-f3e9cdd09e70"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
URIParser = "30578b45-9adc-5946-b283-645ec420af67" URIParser = "30578b45-9adc-5946-b283-645ec420af67"

View File

@ -1,13 +1,16 @@
module PkgTemplates module PkgTemplates
using Base: @kwdef, current_project using Base: current_project
using Base.Filesystem: contractuser using Base.Filesystem: contractuser
using Dates: month, today, year using Dates: month, today, year
using InteractiveUtils: subtypes using InteractiveUtils: subtypes
using LibGit2: LibGit2 using LibGit2: LibGit2
using Mustache: render using Pkg: Pkg, PackageSpec
using Pkg: PackageSpec, Pkg
using REPL.TerminalMenus: MultiSelectMenu, RadioMenu, request using REPL.TerminalMenus: MultiSelectMenu, RadioMenu, request
using Mustache: render
using Parameters: @with_kw
using URIParser: URI using URIParser: URI
export export

View File

@ -34,7 +34,7 @@ abstract type CI <: Plugin end
# julia: 1.0 # julia: 1.0
# (and maybe all the other Julia versions for 32-bit too) # (and maybe all the other Julia versions for 32-bit too)
@kwdef struct TravisCI <: CI @with_kw struct TravisCI <: CI
file::String = default_file("travis.yml") file::String = default_file("travis.yml")
linux::Bool = true linux::Bool = true
osx::Bool = true osx::Bool = true
@ -73,7 +73,7 @@ function view(p::TravisCI, t::Template, ::AbstractString)
) )
end end
@kwdef struct AppVeyor <: CI @with_kw struct AppVeyor <: CI
file::String = default_file("appveyor.yml") file::String = default_file("appveyor.yml")
x86::Bool = false x86::Bool = false
coverage::Bool = true coverage::Bool = true
@ -101,7 +101,7 @@ function view(p::AppVeyor, t::Template, ::AbstractString)
) )
end end
@kwdef struct CirrusCI <: CI @with_kw struct CirrusCI <: CI
file::String = default_file("cirrus.yml") file::String = default_file("cirrus.yml")
image::String = "freebsd-12-0-release-amd64" image::String = "freebsd-12-0-release-amd64"
coverage::Bool = true coverage::Bool = true
@ -128,7 +128,7 @@ function view(p::CirrusCI, t::Template, ::AbstractString)
) )
end end
@kwdef struct GitLabCI <: CI @with_kw struct GitLabCI <: CI
file::String file::String
documentation::Bool = true documentation::Bool = true
coverage::Bool = true coverage::Bool = true

View File

@ -4,7 +4,7 @@
Add `Citation` to a [`Template`](@ref)'s plugin list to generate a `CITATION.bib` file. Add `Citation` to a [`Template`](@ref)'s plugin list to generate a `CITATION.bib` file.
If `readme` is set, then `README.md` will contain a section about citing. If `readme` is set, then `README.md` will contain a section about citing.
""" """
@kwdef struct Citation <: BasicPlugin @with_kw struct Citation <: BasicPlugin
file::String = default_file("CITATION.bib") file::String = default_file("CITATION.bib")
readme::Bool = false readme::Bool = false
end end

View File

@ -4,7 +4,7 @@ const COVERAGE_GITIGNORE = ["*.jl.cov", "*.jl.*.cov", "*.jl.mem"]
gitignore(::Coverage) = COVERAGE_GITIGNORE gitignore(::Coverage) = COVERAGE_GITIGNORE
@kwdef struct Codecov <: Coverage @with_kw struct Codecov <: Coverage
file::Union{String, Nothing} = nothing file::Union{String, Nothing} = nothing
end end
@ -17,7 +17,7 @@ badges(::Codecov) = Badge(
"https://codecov.io/gh/{{USER}}/{{PKG}}.jl", "https://codecov.io/gh/{{USER}}/{{PKG}}.jl",
) )
@kwdef struct Coveralls <: Coverage @with_kw struct Coveralls <: Coverage
file::Union{String, Nothing} = nothing file::Union{String, Nothing} = nothing
end end

View File

@ -13,7 +13,7 @@ const LICENSES = Dict(
"EUPL-1.2+" => "European Union Public Licence, Version 1.2+", "EUPL-1.2+" => "European Union Public Licence, Version 1.2+",
) )
@kwdef struct Readme <: BasicPlugin @with_kw struct Readme <: BasicPlugin
file::String = default_file("README.md") file::String = default_file("README.md")
destination::String = "README.md" destination::String = "README.md"
inline_badges::Bool = false inline_badges::Bool = false
@ -86,7 +86,7 @@ function gen_plugin(p::Gitignore, t::Template, pkg_dir::AbstractString)
gen_file(joinpath(pkg_dir, ".gitignore"), render_plugin(p, t)) gen_file(joinpath(pkg_dir, ".gitignore"), render_plugin(p, t))
end end
@kwdef struct Tests <: BasicPlugin @with_kw struct Tests <: BasicPlugin
file::String = default_file("runtests.jl") file::String = default_file("runtests.jl")
end end