From 2b0e4bc987b5cead0fbbe67b0c16f6999a7bd935 Mon Sep 17 00:00:00 2001 From: Chris de Graaf Date: Wed, 25 Sep 2019 20:48:39 +0700 Subject: [PATCH] Rename julia_version -> julia --- docs/src/migrating.md | 15 ++++++++------- src/plugins/ci.jl | 6 +++--- src/plugins/project_file.jl | 2 +- src/plugins/tests.jl | 5 ++--- src/template.jl | 10 +++++----- test/show.jl | 4 ++-- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/src/migrating.md b/docs/src/migrating.md index 177c47e..40cc7c8 100644 --- a/docs/src/migrating.md +++ b/docs/src/migrating.md @@ -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. diff --git a/src/plugins/ci.jl b/src/plugins/ci.jl index d582e15..825448a 100644 --- a/src/plugins/ci.jl +++ b/src/plugins/ci.jl @@ -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 diff --git a/src/plugins/project_file.jl b/src/plugins/project_file.jl index 91714c0..15ea375 100644 --- a/src/plugins/project_file.jl +++ b/src/plugins/project_file.jl @@ -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 diff --git a/src/plugins/tests.jl b/src/plugins/tests.jl index 156cebd..796c6b5 100644 --- a/src/plugins/tests.jl +++ b/src/plugins/tests.jl @@ -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 diff --git a/src/template.jl b/src/template.jl index 93d39d6..164cbfd 100644 --- a/src/template.jl +++ b/src/template.jl @@ -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() diff --git a/test/show.jl b/test/show.jl index 2e67fd4..8683f43 100644 --- a/test/show.jl +++ b/test/show.jl @@ -18,7 +18,7 @@ const LICENSES_DIR = joinpath(TEMPLATES_DIR, "licenses") authors: ["Chris de Graaf "] 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: