From 632283b8471e1049e1bcd7dc52a09cd2c4b4cd2c Mon Sep 17 00:00:00 2001 From: Chris de Graaf Date: Mon, 17 Sep 2018 14:40:09 -0500 Subject: [PATCH] Replace Void/Nullables --- src/PkgTemplates.jl | 2 ++ src/plugin.jl | 4 ++-- src/plugins/appveyor.jl | 8 ++++---- src/plugins/codecov.jl | 8 ++++---- src/plugins/coveralls.jl | 8 ++++---- src/plugins/documenter.jl | 6 +++--- src/plugins/gitlabci.jl | 8 ++++---- src/plugins/travisci.jl | 8 ++++---- 8 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/PkgTemplates.jl b/src/PkgTemplates.jl index b7bfd96..f07b6ce 100644 --- a/src/PkgTemplates.jl +++ b/src/PkgTemplates.jl @@ -2,6 +2,8 @@ __precompile__() module PkgTemplates using AutoHashEquals +using Dates +using Distributed using Mustache using TerminalMenus using URIParser diff --git a/src/plugin.jl b/src/plugin.jl index 40aeec6..13d2129 100644 --- a/src/plugin.jl +++ b/src/plugin.jl @@ -7,7 +7,7 @@ Generic plugins are plugins that add any number of patterns to the generated pac # Attributes * `gitignore::Vector{AbstractString}`: Array of patterns to be added to the `.gitignore` of generated packages that use this plugin. -* `src::Nullable{AbstractString}`: Path to the file that will be copied into the generated +* `src::Union{AbstractString, Nothing}`: Path to the file that will be copied into the generated package repository. If set to `nothing`, no file will be generated. When this defaults to an empty string, there should be a default file in `defaults` that will be copied. That file's name is usually the same as the plugin's name, except in all lowercase and @@ -25,7 +25,7 @@ Generic plugins are plugins that add any number of patterns to the generated pac ```julia @auto_hash_equals struct MyPlugin <: GenericPlugin gitignore::Vector{AbstractString} - src::Nullable{AbstractString} + src::Union{AbstractString, Nothing} dest::AbstractString badges::Vector{Badge} view::Dict{String, Any} diff --git a/src/plugins/appveyor.jl b/src/plugins/appveyor.jl index 8b0e65c..857d188 100644 --- a/src/plugins/appveyor.jl +++ b/src/plugins/appveyor.jl @@ -1,21 +1,21 @@ """ - AppVeyor(; config_file::Union{AbstractString, Void}="") -> AppVeyor + AppVeyor(; config_file::Union{AbstractString, Nothing}="") -> AppVeyor Add `AppVeyor` to a template's plugins to add a `.appveyor.yml` configuration file to generated repositories, and an appropriate badge to the README. # Keyword Arguments -* `config_file::Union{AbstractString, Void}=""`: Path to a custom `.appveyor.yml`. +* `config_file::Union{AbstractString, Nothing}=""`: Path to a custom `.appveyor.yml`. If `nothing` is supplied, no file will be generated. """ @auto_hash_equals struct AppVeyor <: GenericPlugin gitignore::Vector{AbstractString} - src::Nullable{AbstractString} + src::Union{AbstractString, Nothing} dest::AbstractString badges::Vector{Badge} view::Dict{String, Any} - function AppVeyor(; config_file::Union{AbstractString, Void}="") + function AppVeyor(; config_file::Union{AbstractString, Nothing}="") if config_file != nothing config_file = if isempty(config_file) config_file = joinpath(DEFAULTS_DIR, "appveyor.yml") diff --git a/src/plugins/codecov.jl b/src/plugins/codecov.jl index ae54f52..c605d0d 100644 --- a/src/plugins/codecov.jl +++ b/src/plugins/codecov.jl @@ -1,22 +1,22 @@ """ - CodeCov(; config_file::Union{AbstractString, Void}=nothing) -> CodeCov + CodeCov(; config_file::Union{AbstractString, Nothing}=nothing) -> CodeCov Add `CodeCov` to a template's plugins to optionally add a `.codecov.yml` configuration file to generated repositories, and an appropriate badge to the README. Also updates the `.gitignore` accordingly. # Keyword Arguments: -* `config_file::Union{AbstractString, Void}=nothing`: Path to a custom `.codecov.yml`. +* `config_file::Union{AbstractString, Nothing}=nothing`: Path to a custom `.codecov.yml`. If left unset, no file will be generated. """ @auto_hash_equals struct CodeCov <: GenericPlugin gitignore::Vector{AbstractString} - src::Nullable{AbstractString} + src::Union{AbstractString, Nothing} dest::AbstractString badges::Vector{Badge} view::Dict{String, Any} - function CodeCov(; config_file::Union{AbstractString, Void}=nothing) + function CodeCov(; config_file::Union{AbstractString, Nothing}=nothing) if config_file != nothing config_file = if isfile(config_file) abspath(config_file) diff --git a/src/plugins/coveralls.jl b/src/plugins/coveralls.jl index 0ebb087..1406db7 100644 --- a/src/plugins/coveralls.jl +++ b/src/plugins/coveralls.jl @@ -1,22 +1,22 @@ """ - Coveralls(; config_file::Union{AbstractString, Void}=nothing) -> Coveralls + Coveralls(; config_file::Union{AbstractString, Nothing}=nothing) -> Coveralls Add `Coveralls` to a template's plugins to optionally add a `.coveralls.yml` configuration file to generated repositories, and an appropriate badge to the README. Also updates the `.gitignore` accordingly. # Keyword Arguments: -* `config_file::Union{AbstractString, Void}=nothing`: Path to a custom `.coveralls.yml`. +* `config_file::Union{AbstractString, Nothing}=nothing`: Path to a custom `.coveralls.yml`. If left unset, no file will be generated. """ @auto_hash_equals struct Coveralls <: GenericPlugin gitignore::Vector{AbstractString} - src::Nullable{AbstractString} + src::Union{AbstractString, Nothing} dest::AbstractString badges::Vector{Badge} view::Dict{String, Any} - function Coveralls(; config_file::Union{AbstractString, Void}=nothing) + function Coveralls(; config_file::Union{AbstractString, Nothing}=nothing) if config_file != nothing config_file = if isfile(config_file) abspath(config_file) diff --git a/src/plugins/documenter.jl b/src/plugins/documenter.jl index 76560ce..b699146 100644 --- a/src/plugins/documenter.jl +++ b/src/plugins/documenter.jl @@ -25,12 +25,12 @@ function gen_plugin( # assets/file1, # assets/file2, # ] - const TAB = repeat(" ", 4) + tab = repeat(" ", 4) assets_string = "[\n" for asset in plugin.assets - assets_string *= """$(TAB^2)"assets/$(basename(asset))",\n""" + assets_string *= """$(tab^2)"assets/$(basename(asset))",\n""" end - assets_string *= "$TAB]" + assets_string *= "$tab]" else assets_string = "[]" diff --git a/src/plugins/gitlabci.jl b/src/plugins/gitlabci.jl index 1b63204..c91f4f2 100644 --- a/src/plugins/gitlabci.jl +++ b/src/plugins/gitlabci.jl @@ -1,23 +1,23 @@ """ - GitLabCI(; config_file::Union{AbstractString, Void}="", coverage::Bool=true) -> GitLabCI + GitLabCI(; config_file::Union{AbstractString, Nothing}="", coverage::Bool=true) -> GitLabCI Add `GitLabCI` to a template's plugins to add a `.gitlab-ci.yml` configuration file to generated repositories, and appropriate badge(s) to the README. # Keyword Arguments: -* `config_file::Union{AbstractString, Void}=""`: Path to a custom `.gitlab-ci.yml`. +* `config_file::Union{AbstractString, Nothing}=""`: Path to a custom `.gitlab-ci.yml`. If `nothing` is supplied, no file will be generated. * `coverage::Bool=true`: Whether or not GitLab CI's built-in code coverage analysis should be enabled. """ @auto_hash_equals struct GitLabCI <: GenericPlugin gitignore::Vector{AbstractString} - src::Nullable{AbstractString} + src::Union{AbstractString, Nothing} dest::AbstractString badges::Vector{Badge} view::Dict{String, Any} - function GitLabCI(; config_file::Union{AbstractString, Void}="", coverage::Bool=true) + function GitLabCI(; config_file::Union{AbstractString, Nothing}="", coverage::Bool=true) if config_file != nothing config_file = if isempty(config_file) config_file = joinpath(DEFAULTS_DIR, "gitlab-ci.yml") diff --git a/src/plugins/travisci.jl b/src/plugins/travisci.jl index 12401ee..6aa33a8 100644 --- a/src/plugins/travisci.jl +++ b/src/plugins/travisci.jl @@ -1,21 +1,21 @@ """ - TravisCI(; config_file::Union{AbstractString, Void}="") -> TravisCI + TravisCI(; config_file::Union{AbstractString, Nothing}="") -> TravisCI Add `TravisCI` to a template's plugins to add a `.travis.yml` configuration file to generated repositories, and an appropriate badge to the README. # Keyword Arguments: -* `config_file::Union{AbstractString, Void}=""`: Path to a custom `.travis.yml`. +* `config_file::Union{AbstractString, Nothing}=""`: Path to a custom `.travis.yml`. If `nothing` is supplied, no file will be generated. """ @auto_hash_equals struct TravisCI <: GenericPlugin gitignore::Vector{AbstractString} - src::Nullable{AbstractString} + src::Union{AbstractString, Nothing} dest::AbstractString badges::Vector{Badge} view::Dict{String, Any} - function TravisCI(; config_file::Union{AbstractString, Void}="") + function TravisCI(; config_file::Union{AbstractString, Nothing}="") if config_file != nothing config_file = if isempty(config_file) config_file = joinpath(DEFAULTS_DIR, "travis.yml")