Add version option to ProjectFile plugin to set initial version
This commit is contained in:
parent
aaa1f5280c
commit
6bb3c2c669
@ -1,19 +1,24 @@
|
||||
"""
|
||||
ProjectFile()
|
||||
ProjectFile(; version=v"0.1.0")
|
||||
|
||||
Creates a `Project.toml`.
|
||||
|
||||
## Keyword Arguments
|
||||
- `version::VersionNumber`: The initial version of created packages.
|
||||
"""
|
||||
struct ProjectFile <: Plugin end
|
||||
@with_kw_noshow struct ProjectFile <: Plugin
|
||||
version::VersionNumber = v"0.1.0"
|
||||
end
|
||||
|
||||
# Other plugins like Tests will modify this file.
|
||||
priority(::ProjectFile, ::typeof(hook)) = typemax(Int) - 5
|
||||
|
||||
function hook(::ProjectFile, t::Template, pkg_dir::AbstractString)
|
||||
function hook(p::ProjectFile, t::Template, pkg_dir::AbstractString)
|
||||
toml = Dict(
|
||||
"name" => basename(pkg_dir),
|
||||
"uuid" => string(uuid4()),
|
||||
"authors" => t.authors,
|
||||
"version" => "0.1.0",
|
||||
"version" => string(p.version),
|
||||
"compat" => Dict("julia" => compat_version(t.julia)),
|
||||
)
|
||||
open(io -> TOML.print(io, toml), joinpath(pkg_dir, "Project.toml"), "w")
|
||||
|
2
test/fixtures/WackyOptions/Project.toml
vendored
2
test/fixtures/WackyOptions/Project.toml
vendored
@ -1,7 +1,7 @@
|
||||
name = "WackyOptions"
|
||||
uuid = "5b7e9947-ddc0-4b3f-9b55-0d8042f74170"
|
||||
authors = ["tester"]
|
||||
version = "0.1.0"
|
||||
version = "1.0.0"
|
||||
|
||||
[compat]
|
||||
julia = "1.2"
|
||||
|
@ -43,6 +43,7 @@ end
|
||||
Git(; ignore=["a", "b", "c"], manifest=true),
|
||||
GitLabCI(; coverage=false, extra_versions=[v"0.6"]),
|
||||
License(; name="ISC"),
|
||||
ProjectFile(; version=v"1"),
|
||||
Readme(; inline_badges=true),
|
||||
Tests(; project=true),
|
||||
TravisCI(;
|
||||
|
@ -38,7 +38,8 @@ const LICENSES_DIR = joinpath(TEMPLATES_DIR, "licenses")
|
||||
License:
|
||||
path: "$(joinpath(LICENSES_DIR, "MIT"))"
|
||||
destination: "LICENSE"
|
||||
ProjectFile
|
||||
ProjectFile:
|
||||
version: v"0.1.0"
|
||||
Readme:
|
||||
file: "$(joinpath(TEMPLATES_DIR, "README.md"))"
|
||||
destination: "README.md"
|
||||
|
Loading…
Reference in New Issue
Block a user