diff --git a/defaults/codecov.yml b/defaults/codecov.yml deleted file mode 100644 index 69cb760..0000000 --- a/defaults/codecov.yml +++ /dev/null @@ -1 +0,0 @@ -comment: false diff --git a/src/plugins/codecov.jl b/src/plugins/codecov.jl index 6d94c3f..ae54f52 100644 --- a/src/plugins/codecov.jl +++ b/src/plugins/codecov.jl @@ -1,13 +1,13 @@ """ - CodeCov(; config_file::Union{AbstractString, Void}="") -> CodeCov + CodeCov(; config_file::Union{AbstractString, Void}=nothing) -> CodeCov -Add `CodeCov` to a template's plugins to add a `.codecov.yml` configuration file to -generated repositories, and an appropriate badge to the README. Also updates the +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}=""`: Path to a custom `.codecov.yml`. - If `nothing` is supplied, no file will be generated. +* `config_file::Union{AbstractString, Void}=nothing`: Path to a custom `.codecov.yml`. + If left unset, no file will be generated. """ @auto_hash_equals struct CodeCov <: GenericPlugin gitignore::Vector{AbstractString} @@ -16,11 +16,9 @@ generated repositories, and an appropriate badge to the README. Also updates the badges::Vector{Badge} view::Dict{String, Any} - function CodeCov(; config_file::Union{AbstractString, Void}="") + function CodeCov(; config_file::Union{AbstractString, Void}=nothing) if config_file != nothing - config_file = if isempty(config_file) - config_file = joinpath(DEFAULTS_DIR, "codecov.yml") - elseif isfile(config_file) + config_file = if isfile(config_file) abspath(config_file) else throw(ArgumentError("File $(abspath(config_file)) does not exist")) @@ -41,3 +39,5 @@ generated repositories, and an appropriate badge to the README. Also updates the ) end end + +interactive(plugin_type::Type{CodeCov}) = interactive(plugin_type; file=nothing) diff --git a/src/plugins/coveralls.jl b/src/plugins/coveralls.jl index c69d104..0ebb087 100644 --- a/src/plugins/coveralls.jl +++ b/src/plugins/coveralls.jl @@ -1,5 +1,5 @@ """ - Coveralls(; config_file::Union{AbstractString, Void}="") -> Coveralls + Coveralls(; config_file::Union{AbstractString, Void}=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 diff --git a/test/interactive/plugins.jl b/test/interactive/plugins.jl index 5185f43..ddf3efa 100644 --- a/test/interactive/plugins.jl +++ b/test/interactive/plugins.jl @@ -50,7 +50,7 @@ end @testset "CodeCov" begin write(STDIN.buffer, "\n") p = interactive(CodeCov) - @test get(p.src, "") == joinpath(DEFAULTS_DIR, "codecov.yml") + @test isnull(p.src) write(STDIN.buffer, "$test_file\n") p = interactive(CodeCov) @test get(p.src, "") == test_file diff --git a/test/plugins/codecov.jl b/test/plugins/codecov.jl index 5d167ae..e4db4bf 100644 --- a/test/plugins/codecov.jl +++ b/test/plugins/codecov.jl @@ -7,7 +7,7 @@ pkg_dir = joinpath(temp_dir, test_pkg) @testset "Plugin creation" begin p = CodeCov() @test p.gitignore == ["*.jl.cov", "*.jl.*.cov", "*.jl.mem"] - @test get(p.src, "") == joinpath(PkgTemplates.DEFAULTS_DIR, "codecov.yml") + @test isnull(p.src) @test p.dest == ".codecov.yml" @test p.badges == [ Badge( @@ -31,9 +31,8 @@ pkg_dir = joinpath(temp_dir, test_pkg) @testset "File generation" begin p = CodeCov() - @test gen_plugin(p, t, temp_dir, test_pkg) == [".codecov.yml"] - @test isfile(joinpath(pkg_dir, ".codecov.yml")) - rm(joinpath(pkg_dir, ".codecov.yml")) + @test isempty(gen_plugin(p, t, temp_dir, test_pkg)) + @test !isfile(joinpath(pkg_dir, ".codecov.yml")) p = CodeCov(; config_file=nothing) @test isempty(gen_plugin(p, t, temp_dir, test_pkg)) @test !isfile(joinpath(pkg_dir, ".codecov.yml")) diff --git a/test/tests.jl b/test/tests.jl index 8063578..f4cb542 100644 --- a/test/tests.jl +++ b/test/tests.jl @@ -265,7 +265,6 @@ end @test !isfile(Pkg.dir(test_pkg, "LICENSE")) @test isfile(Pkg.dir(test_pkg, ".travis.yml")) @test isfile(Pkg.dir(test_pkg, ".appveyor.yml")) - @test isfile(Pkg.dir(test_pkg, ".codecov.yml")) @test isdir(Pkg.dir(test_pkg, "docs")) @test isfile(Pkg.dir(test_pkg, "docs", "make.jl")) @test isdir(Pkg.dir(test_pkg, "docs", "src"))