From 82638e31bcedc4b0b41bc41eba8dafcad8f83d3e Mon Sep 17 00:00:00 2001 From: Chris de Graaf Date: Tue, 22 Aug 2017 14:31:28 -0500 Subject: [PATCH] User github.user config key instead of github.username --- src/template.jl | 8 ++++---- test/tests.jl | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/template.jl b/src/template.jl index b23865d..062deda 100644 --- a/src/template.jl +++ b/src/template.jl @@ -6,7 +6,7 @@ create a template, you can use [`interactive_template`](@ref) instead. # Keyword Arguments * `user::AbstractString="")`: GitHub username. If left unset, it will try to take the - value of a supplied git config's "github.username" key, then the global git config's + value of a supplied git config's "github.user" key, then the global git config's value. If neither is set, an `ArgumentError` is thrown. **This is case-sensitive for some plugins, so take care to enter it correctly.** * `host::AbstractString="github.com"`: URL to the code hosting service where your package @@ -70,8 +70,8 @@ don't belong. # and then in the global git config. if isempty(user) user = get( - git_config, "github.username", - LibGit2.getconfig("github.username", ""), + git_config, "github.user", + LibGit2.getconfig("github.user", ""), ) end if isempty(user) @@ -132,7 +132,7 @@ function interactive_template(; fast::Bool=false) plugin_types = @spawn leaves(Plugin) kwargs = Dict{Symbol, Any}() - default_user = LibGit2.getconfig("github.username", "") + default_user = LibGit2.getconfig("github.user", "") print("Enter your username [$(isempty(default_user) ? "REQUIRED" : default_user)]: ") user = readline() kwargs[:user] = if !isempty(user) diff --git a/test/tests.jl b/test/tests.jl index 823b776..4814bf1 100644 --- a/test/tests.jl +++ b/test/tests.jl @@ -13,7 +13,7 @@ const me = "christopher-dG" const git_config = Dict( "user.name" => "Tester McTestFace", "user.email" => "email@web.site", - "github.username" => "TesterMcTestFace", + "github.user" => "TesterMcTestFace", ) const test_pkg = "TestPkg" const fake_path = bin(hash("/this/file/does/not/exist")) @@ -94,7 +94,7 @@ write(test_file, template_text) t = Template(; git_config=git_config) rm(t.temp_dir; recursive=true) - @test t.user == git_config["github.username"] + @test t.user == git_config["github.user"] @test t.authors == git_config["user.name"] t = Template(; @@ -115,11 +115,11 @@ write(test_file, template_text) ) rm(t.temp_dir; recursive=true) - if isempty(LibGit2.getconfig("github.username", "")) + if isempty(LibGit2.getconfig("github.user", "")) @test_throws ArgumentError t = Template() else t = Template() - @test t.user == LibGit2.getconfig("github.username", "") + @test t.user == LibGit2.getconfig("github.user", "") end rm(t.temp_dir; force=true, recursive=true) @test_throws ArgumentError t = Template(; user=me, license="FakeLicense") @@ -208,7 +208,7 @@ end end @testset "Badge generation" begin - user = git_config["github.username"] + user = git_config["github.user"] badge = Badge("A", "B", "C") @test badge.hover == "A"