Rename julia_version -> julia

This commit is contained in:
Chris de Graaf 2019-09-25 20:48:39 +07:00
parent cd40cb4b7e
commit 2b0e4bc987
No known key found for this signature in database
GPG Key ID: 150FFDD9B0073C7B
6 changed files with 21 additions and 21 deletions

View File

@ -13,10 +13,11 @@ However, it might be easier to just read the [User Guide](user.md).
The recurring theme is "everything is a plugin now". The recurring theme is "everything is a plugin now".
| Old | New | | Old | New |
| :-: | :-: | | :------------------: | :-------------------------------: |
| `license="ISC"` | `plugins=[License(; name="ISC")]` | | `license="ISC"` | `plugins=[License(; name="ISC")]` |
| `develop=true` * | `plugins=[Develop()]` | | `develop=true` * | `plugins=[Develop()]` |
| `git=false` | `disable_defaults=[Git]` | | `git=false` | `disable_defaults=[Git]` |
| `julia_version=v"1"` | `julia=v"1"` |
| `ssh=true` | `plugins=[Git(; ssh=true)]` | | `ssh=true` | `plugins=[Git(; ssh=true)]` |
| `manifest=true` | `plugins=[Git(; manifest=true)]` | | `manifest=true` | `plugins=[Git(; manifest=true)]` |

View File

@ -18,7 +18,7 @@ Combine `t`'s Julia version with `versions`, and format them as `major.minor`.
This is useful for creating lists of versions to be included in CI configurations. This is useful for creating lists of versions to be included in CI configurations.
""" """
function collect_versions(t::Template, versions::Vector) function collect_versions(t::Template, versions::Vector)
vs = map(format_version, [t.julia_version, versions...]) vs = map(format_version, [t.julia, versions...])
return sort(unique(vs)) return sort(unique(vs))
end end
@ -91,7 +91,7 @@ function view(p::TravisCI, t::Template, pkg::AbstractString)
"OS" => os, "OS" => os,
"PKG" => pkg, "PKG" => pkg,
"USER" => t.user, "USER" => t.user,
"VERSION" => format_version(t.julia_version), "VERSION" => format_version(t.julia),
"VERSIONS" => versions, "VERSIONS" => versions,
"X86" => x86, "X86" => x86,
) )
@ -247,7 +247,7 @@ function view(p::GitLabCI, t::Template, pkg::AbstractString)
"HAS_DOCUMENTER" => hasplugin(t, Documenter{GitLabCI}), "HAS_DOCUMENTER" => hasplugin(t, Documenter{GitLabCI}),
"PKG" => pkg, "PKG" => pkg,
"USER" => t.user, "USER" => t.user,
"VERSION" => format_version(t.julia_version), "VERSION" => format_version(t.julia),
"VERSIONS" => collect_versions(t, p.extra_versions), "VERSIONS" => collect_versions(t, p.extra_versions),
) )
end end

View File

@ -14,7 +14,7 @@ function hook(::ProjectFile, t::Template, pkg_dir::AbstractString)
"uuid" => string(uuid4()), "uuid" => string(uuid4()),
"authors" => t.authors, "authors" => t.authors,
"version" => "0.1.0", "version" => "0.1.0",
"compat" => Dict("julia" => compat_version(t.julia_version)), "compat" => Dict("julia" => compat_version(t.julia)),
) )
open(io -> TOML.print(io, toml), joinpath(pkg_dir, "Project.toml"), "w") open(io -> TOML.print(io, toml), joinpath(pkg_dir, "Project.toml"), "w")
end end

View File

@ -25,13 +25,12 @@ view(::Tests, ::Template, pkg::AbstractString) = Dict("PKG" => pkg)
function prehook(p::Tests, t::Template, pkg_dir::AbstractString) function prehook(p::Tests, t::Template, pkg_dir::AbstractString)
invoke(prehook, Tuple{BasicPlugin, Template, AbstractString}, p, t, pkg_dir) invoke(prehook, Tuple{BasicPlugin, Template, AbstractString}, p, t, pkg_dir)
p.project && t.julia_version < v"1.2" && @warn string( p.project && t.julia < v"1.2" && @warn string(
"Tests: The project option is set to create a project (supported in Julia 1.2 and later) ", "Tests: The project option is set to create a project (supported in Julia 1.2 and later) ",
"but a Julia version older than 1.2 is supported by the Template.", "but a Julia version older than 1.2 is supported by the Template.",
) )
end end
function hook(p::Tests, t::Template, pkg_dir::AbstractString) function hook(p::Tests, t::Template, pkg_dir::AbstractString)
# Do the normal BasicPlugin behaviour to create the test script. # Do the normal BasicPlugin behaviour to create the test script.
invoke(hook, Tuple{BasicPlugin, Template, AbstractString}, p, t, pkg_dir) invoke(hook, Tuple{BasicPlugin, Template, AbstractString}, p, t, pkg_dir)

View File

@ -26,7 +26,7 @@ A configuration used to generate packages.
### Package Options ### Package Options
- `dir::AbstractString="$(contractuser(Pkg.devdir()))"`: Directory to place packages in. - `dir::AbstractString="$(contractuser(Pkg.devdir()))"`: Directory to place packages in.
- `host::AbstractString="github.com"`: URL to the code hosting service where packages will reside. - `host::AbstractString="github.com"`: URL to the code hosting service where packages will reside.
- `julia_version::VersionNumber=$(repr(default_version()))`: Minimum allowed Julia version. - `julia::VersionNumber=$(repr(default_version()))`: Minimum allowed Julia version.
### Template Plugins ### Template Plugins
- `plugins::Vector{<:Plugin}=Plugin[]`: A list of [`Plugin`](@ref)s used by the template. - `plugins::Vector{<:Plugin}=Plugin[]`: A list of [`Plugin`](@ref)s used by the template.
@ -51,7 +51,7 @@ struct Template
authors::Vector{String} authors::Vector{String}
dir::String dir::String
host::String host::String
julia_version::VersionNumber julia::VersionNumber
plugins::Vector{<:Plugin} plugins::Vector{<:Plugin}
user::String user::String
end end
@ -63,7 +63,7 @@ function Template(::Val{false}; kwargs...)
user = getkw(kwargs, :user) user = getkw(kwargs, :user)
dir = abspath(expanduser(getkw(kwargs, :dir))) dir = abspath(expanduser(getkw(kwargs, :dir)))
host = replace(getkw(kwargs, :host), r".*://" => "") host = replace(getkw(kwargs, :host), r".*://" => "")
julia_version = getkw(kwargs, :julia_version) julia = getkw(kwargs, :julia)
authors = getkw(kwargs, :authors) authors = getkw(kwargs, :authors)
authors isa Vector || (authors = map(strip, split(authors, ","))) authors isa Vector || (authors = map(strip, split(authors, ",")))
@ -85,7 +85,7 @@ function Template(::Val{false}; kwargs...)
end end
end end
return Template(authors, dir, host, julia_version, plugins, user) return Template(authors, dir, host, julia, plugins, user)
end end
""" """
@ -133,6 +133,6 @@ defaultkw(::Val{:authors}) = default_authors()
defaultkw(::Val{:dir}) = Pkg.devdir() defaultkw(::Val{:dir}) = Pkg.devdir()
defaultkw(::Val{:disable_defaults}) = DataType[] defaultkw(::Val{:disable_defaults}) = DataType[]
defaultkw(::Val{:host}) = "github.com" defaultkw(::Val{:host}) = "github.com"
defaultkw(::Val{:julia_version}) = default_version() defaultkw(::Val{:julia}) = default_version()
defaultkw(::Val{:plugins}) = Plugin[] defaultkw(::Val{:plugins}) = Plugin[]
defaultkw(::Val{:user}) = default_user() defaultkw(::Val{:user}) = default_user()

View File

@ -18,7 +18,7 @@ const LICENSES_DIR = joinpath(TEMPLATES_DIR, "licenses")
authors: ["Chris de Graaf <chrisadegraaf@gmail.com>"] authors: ["Chris de Graaf <chrisadegraaf@gmail.com>"]
dir: "~/.local/share/julia/dev" dir: "~/.local/share/julia/dev"
host: "github.com" host: "github.com"
julia_version: v"1.0.0" julia: v"1.0.0"
user: "$USER" user: "$USER"
plugins: plugins:
""" """
@ -27,7 +27,7 @@ const LICENSES_DIR = joinpath(TEMPLATES_DIR, "licenses")
authors: ["$USER"] authors: ["$USER"]
dir: "$(contractuser(Pkg.devdir()))" dir: "$(contractuser(Pkg.devdir()))"
host: "github.com" host: "github.com"
julia_version: v"1.0.0" julia: v"1.0.0"
user: "$USER" user: "$USER"
plugins: plugins:
Git: Git: