Make the .jl remote suffix optional (#172)
This commit is contained in:
parent
bffedf49ab
commit
88774305b8
@ -1,7 +1,7 @@
|
|||||||
name = "PkgTemplates"
|
name = "PkgTemplates"
|
||||||
uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1"
|
uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1"
|
||||||
authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"]
|
authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"]
|
||||||
version = "0.7.0"
|
version = "0.7.1"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
|
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
name=nothing,
|
name=nothing,
|
||||||
email=nothing,
|
email=nothing,
|
||||||
ssh=false,
|
ssh=false,
|
||||||
|
jl=true,
|
||||||
manifest=false,
|
manifest=false,
|
||||||
gpgsign=false,
|
gpgsign=false,
|
||||||
)
|
)
|
||||||
@ -17,6 +18,7 @@ Creates a Git repository and a `.gitignore` file.
|
|||||||
- `email::AbstractString`: Your email address, if you have not set `user.email` with Git.
|
- `email::AbstractString`: Your email address, if you have not set `user.email` with Git.
|
||||||
- `ssh::Bool`: Whether or not to use SSH for the remote.
|
- `ssh::Bool`: Whether or not to use SSH for the remote.
|
||||||
If left unset, HTTPS is used.
|
If left unset, HTTPS is used.
|
||||||
|
- `jl::Bool`: Whether or not to add a `.jl` suffix to the remote URL.
|
||||||
- `manifest::Bool`: Whether or not to commit `Manifest.toml`.
|
- `manifest::Bool`: Whether or not to commit `Manifest.toml`.
|
||||||
- `gpgsign::Bool`: Whether or not to sign commits with your GPG key.
|
- `gpgsign::Bool`: Whether or not to sign commits with your GPG key.
|
||||||
This option requires that the Git CLI is installed,
|
This option requires that the Git CLI is installed,
|
||||||
@ -27,6 +29,7 @@ Creates a Git repository and a `.gitignore` file.
|
|||||||
name::Union{String, Nothing} = nothing
|
name::Union{String, Nothing} = nothing
|
||||||
email::Union{String, Nothing} = nothing
|
email::Union{String, Nothing} = nothing
|
||||||
ssh::Bool = false
|
ssh::Bool = false
|
||||||
|
jl::Bool = true
|
||||||
manifest::Bool = false
|
manifest::Bool = false
|
||||||
gpgsign::Bool = false
|
gpgsign::Bool = false
|
||||||
end
|
end
|
||||||
@ -64,10 +67,11 @@ function prehook(p::Git, t::Template, pkg_dir::AbstractString)
|
|||||||
end
|
end
|
||||||
commit(p, repo, pkg_dir, "Initial commit")
|
commit(p, repo, pkg_dir, "Initial commit")
|
||||||
pkg = basename(pkg_dir)
|
pkg = basename(pkg_dir)
|
||||||
|
suffix = p.jl ? ".jl" : ""
|
||||||
url = if p.ssh
|
url = if p.ssh
|
||||||
"git@$(t.host):$(t.user)/$pkg.jl.git"
|
"git@$(t.host):$(t.user)/$pkg$suffix.git"
|
||||||
else
|
else
|
||||||
"https://$(t.host)/$(t.user)/$pkg.jl"
|
"https://$(t.host)/$(t.user)/$pkg$suffix"
|
||||||
end
|
end
|
||||||
LibGit2.with(GitRemote(repo, "origin", url)) do remote
|
LibGit2.with(GitRemote(repo, "origin", url)) do remote
|
||||||
LibGit2.add_fetch!(repo, remote, "refs/heads/master")
|
LibGit2.add_fetch!(repo, remote, "refs/heads/master")
|
||||||
|
10
test/git.jl
10
test/git.jl
@ -37,6 +37,16 @@
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@testset "Without .jl suffix" begin
|
||||||
|
t = tpl(; plugins=[Git(; jl=false)])
|
||||||
|
with_pkg(t) do pkg
|
||||||
|
LibGit2.with(GitRepo(joinpath(t.dir, pkg))) do repo
|
||||||
|
remote = LibGit2.get(GitRemote, repo, "origin")
|
||||||
|
@test !occursin(".jl", LibGit2.url(remote))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@testset "With custom name/email" begin
|
@testset "With custom name/email" begin
|
||||||
t = tpl(; plugins=[Git(; name="me", email="a@b.c")])
|
t = tpl(; plugins=[Git(; name="me", email="a@b.c")])
|
||||||
with_pkg(t) do pkg
|
with_pkg(t) do pkg
|
||||||
|
@ -41,6 +41,7 @@ end
|
|||||||
name: nothing
|
name: nothing
|
||||||
email: nothing
|
email: nothing
|
||||||
ssh: false
|
ssh: false
|
||||||
|
jl: true
|
||||||
manifest: false
|
manifest: false
|
||||||
gpgsign: false
|
gpgsign: false
|
||||||
License:
|
License:
|
||||||
|
Loading…
Reference in New Issue
Block a user