From cfed5fc7e6c181710969fe7aa53a00027c2c1009 Mon Sep 17 00:00:00 2001 From: Chris de Graaf Date: Mon, 26 Aug 2019 22:24:49 +0700 Subject: [PATCH] Use Parameters.with_kw instead of kwdef for 1.0 compat --- Manifest.toml | 12 ++++++++++++ Project.toml | 1 + src/PkgTemplates.jl | 9 ++++++--- src/plugins/ci.jl | 8 ++++---- src/plugins/citation.jl | 2 +- src/plugins/coverage.jl | 4 ++-- src/plugins/essentials.jl | 4 ++-- 7 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Manifest.toml b/Manifest.toml index 24d77f8..c709f1d 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -53,6 +53,18 @@ git-tree-sha1 = "f39de3a12232eb47bd0629b3a661054287780276" uuid = "ffc61752-8dc7-55ee-8c37-f3e9cdd09e70" 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]] deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" diff --git a/Project.toml b/Project.toml index 5df5d89..863df15 100644 --- a/Project.toml +++ b/Project.toml @@ -8,6 +8,7 @@ Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433" Mustache = "ffc61752-8dc7-55ee-8c37-f3e9cdd09e70" +Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" URIParser = "30578b45-9adc-5946-b283-645ec420af67" diff --git a/src/PkgTemplates.jl b/src/PkgTemplates.jl index 76c715a..7fe5abb 100644 --- a/src/PkgTemplates.jl +++ b/src/PkgTemplates.jl @@ -1,13 +1,16 @@ module PkgTemplates -using Base: @kwdef, current_project +using Base: current_project using Base.Filesystem: contractuser + using Dates: month, today, year using InteractiveUtils: subtypes using LibGit2: LibGit2 -using Mustache: render -using Pkg: PackageSpec, Pkg +using Pkg: Pkg, PackageSpec using REPL.TerminalMenus: MultiSelectMenu, RadioMenu, request + +using Mustache: render +using Parameters: @with_kw using URIParser: URI export diff --git a/src/plugins/ci.jl b/src/plugins/ci.jl index f4f02b8..4ce207e 100644 --- a/src/plugins/ci.jl +++ b/src/plugins/ci.jl @@ -34,7 +34,7 @@ abstract type CI <: Plugin end # julia: 1.0 # (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") linux::Bool = true osx::Bool = true @@ -73,7 +73,7 @@ function view(p::TravisCI, t::Template, ::AbstractString) ) end -@kwdef struct AppVeyor <: CI +@with_kw struct AppVeyor <: CI file::String = default_file("appveyor.yml") x86::Bool = false coverage::Bool = true @@ -101,7 +101,7 @@ function view(p::AppVeyor, t::Template, ::AbstractString) ) end -@kwdef struct CirrusCI <: CI +@with_kw struct CirrusCI <: CI file::String = default_file("cirrus.yml") image::String = "freebsd-12-0-release-amd64" coverage::Bool = true @@ -128,7 +128,7 @@ function view(p::CirrusCI, t::Template, ::AbstractString) ) end -@kwdef struct GitLabCI <: CI +@with_kw struct GitLabCI <: CI file::String documentation::Bool = true coverage::Bool = true diff --git a/src/plugins/citation.jl b/src/plugins/citation.jl index 34365d5..8d3e2a4 100644 --- a/src/plugins/citation.jl +++ b/src/plugins/citation.jl @@ -4,7 +4,7 @@ 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. """ -@kwdef struct Citation <: BasicPlugin +@with_kw struct Citation <: BasicPlugin file::String = default_file("CITATION.bib") readme::Bool = false end diff --git a/src/plugins/coverage.jl b/src/plugins/coverage.jl index 25cf03f..f1cd709 100644 --- a/src/plugins/coverage.jl +++ b/src/plugins/coverage.jl @@ -4,7 +4,7 @@ const COVERAGE_GITIGNORE = ["*.jl.cov", "*.jl.*.cov", "*.jl.mem"] gitignore(::Coverage) = COVERAGE_GITIGNORE -@kwdef struct Codecov <: Coverage +@with_kw struct Codecov <: Coverage file::Union{String, Nothing} = nothing end @@ -17,7 +17,7 @@ badges(::Codecov) = Badge( "https://codecov.io/gh/{{USER}}/{{PKG}}.jl", ) -@kwdef struct Coveralls <: Coverage +@with_kw struct Coveralls <: Coverage file::Union{String, Nothing} = nothing end diff --git a/src/plugins/essentials.jl b/src/plugins/essentials.jl index 49741e0..5522d68 100644 --- a/src/plugins/essentials.jl +++ b/src/plugins/essentials.jl @@ -13,7 +13,7 @@ const LICENSES = Dict( "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") destination::String = "README.md" 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)) end -@kwdef struct Tests <: BasicPlugin +@with_kw struct Tests <: BasicPlugin file::String = default_file("runtests.jl") end