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

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

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.
"""
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))
end
@ -91,7 +91,7 @@ function view(p::TravisCI, t::Template, pkg::AbstractString)
"OS" => os,
"PKG" => pkg,
"USER" => t.user,
"VERSION" => format_version(t.julia_version),
"VERSION" => format_version(t.julia),
"VERSIONS" => versions,
"X86" => x86,
)
@ -247,7 +247,7 @@ function view(p::GitLabCI, t::Template, pkg::AbstractString)
"HAS_DOCUMENTER" => hasplugin(t, Documenter{GitLabCI}),
"PKG" => pkg,
"USER" => t.user,
"VERSION" => format_version(t.julia_version),
"VERSION" => format_version(t.julia),
"VERSIONS" => collect_versions(t, p.extra_versions),
)
end

View File

@ -14,7 +14,7 @@ function hook(::ProjectFile, t::Template, pkg_dir::AbstractString)
"uuid" => string(uuid4()),
"authors" => t.authors,
"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")
end

View File

@ -25,13 +25,12 @@ view(::Tests, ::Template, pkg::AbstractString) = Dict("PKG" => pkg)
function prehook(p::Tests, t::Template, pkg_dir::AbstractString)
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) ",
"but a Julia version older than 1.2 is supported by the Template.",
)
end
function hook(p::Tests, t::Template, pkg_dir::AbstractString)
# Do the normal BasicPlugin behaviour to create the test script.
invoke(hook, Tuple{BasicPlugin, Template, AbstractString}, p, t, pkg_dir)
@ -56,7 +55,7 @@ function add_test_dependency(pkg_dir::AbstractString)
open(io -> TOML.print(io, toml), path, "w")
# Generate the manifest by updating the project.
# This also ensures that keys in Project.toml are sorted properly.
# This also ensures that keys in Project.toml are sorted properly.
touch(joinpath(pkg_dir, "Manifest.toml")) # File must exist to be modified by Pkg.
with_project(Pkg.update, pkg_dir)
end

View File

@ -26,7 +26,7 @@ A configuration used to generate packages.
### Package Options
- `dir::AbstractString="$(contractuser(Pkg.devdir()))"`: Directory to place packages in.
- `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
- `plugins::Vector{<:Plugin}=Plugin[]`: A list of [`Plugin`](@ref)s used by the template.
@ -51,7 +51,7 @@ struct Template
authors::Vector{String}
dir::String
host::String
julia_version::VersionNumber
julia::VersionNumber
plugins::Vector{<:Plugin}
user::String
end
@ -63,7 +63,7 @@ function Template(::Val{false}; kwargs...)
user = getkw(kwargs, :user)
dir = abspath(expanduser(getkw(kwargs, :dir)))
host = replace(getkw(kwargs, :host), r".*://" => "")
julia_version = getkw(kwargs, :julia_version)
julia = getkw(kwargs, :julia)
authors = getkw(kwargs, :authors)
authors isa Vector || (authors = map(strip, split(authors, ",")))
@ -85,7 +85,7 @@ function Template(::Val{false}; kwargs...)
end
end
return Template(authors, dir, host, julia_version, plugins, user)
return Template(authors, dir, host, julia, plugins, user)
end
"""
@ -133,6 +133,6 @@ defaultkw(::Val{:authors}) = default_authors()
defaultkw(::Val{:dir}) = Pkg.devdir()
defaultkw(::Val{:disable_defaults}) = DataType[]
defaultkw(::Val{:host}) = "github.com"
defaultkw(::Val{:julia_version}) = default_version()
defaultkw(::Val{:julia}) = default_version()
defaultkw(::Val{:plugins}) = Plugin[]
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>"]
dir: "~/.local/share/julia/dev"
host: "github.com"
julia_version: v"1.0.0"
julia: v"1.0.0"
user: "$USER"
plugins:
"""
@ -27,7 +27,7 @@ const LICENSES_DIR = joinpath(TEMPLATES_DIR, "licenses")
authors: ["$USER"]
dir: "$(contractuser(Pkg.devdir()))"
host: "github.com"
julia_version: v"1.0.0"
julia: v"1.0.0"
user: "$USER"
plugins:
Git: