Don't always commit Manifest.toml
This commit is contained in:
parent
2797d6dffc
commit
5cf4954780
@ -217,6 +217,7 @@ Returns an array of generated file/directory names.
|
|||||||
function gen_gitignore(pkg_dir::AbstractString, t::Template)
|
function gen_gitignore(pkg_dir::AbstractString, t::Template)
|
||||||
pkg = basename(pkg_dir)
|
pkg = basename(pkg_dir)
|
||||||
seen = [".DS_Store"]
|
seen = [".DS_Store"]
|
||||||
|
t.manifest || push!(seen, "Manifest.toml")
|
||||||
patterns = vcat(map(p -> p.gitignore, values(t.plugins))...)
|
patterns = vcat(map(p -> p.gitignore, values(t.plugins))...)
|
||||||
for pattern in patterns
|
for pattern in patterns
|
||||||
if !in(pattern, seen)
|
if !in(pattern, seen)
|
||||||
|
@ -23,6 +23,7 @@ create a template, you can use [`interactive_template`](@ref) instead.
|
|||||||
package will go. Relative paths are converted to absolute ones at template creation time.
|
package will go. Relative paths are converted to absolute ones at template creation time.
|
||||||
* `julia_version::VersionNumber=$VERSION`: Minimum allowed Julia version.
|
* `julia_version::VersionNumber=$VERSION`: Minimum allowed Julia version.
|
||||||
* `ssh::Bool=false`: Whether or not to use SSH for the remote.
|
* `ssh::Bool=false`: Whether or not to use SSH for the remote.
|
||||||
|
* `manifest::Bool=false`: Whether or not to commit the `Manifest.toml`.
|
||||||
* `plugins::Vector{<:Plugin}=Plugin[]`: A list of `Plugin`s that the package will include.
|
* `plugins::Vector{<:Plugin}=Plugin[]`: A list of `Plugin`s that the package will include.
|
||||||
"""
|
"""
|
||||||
@auto_hash_equals struct Template
|
@auto_hash_equals struct Template
|
||||||
@ -33,6 +34,7 @@ create a template, you can use [`interactive_template`](@ref) instead.
|
|||||||
dir::AbstractString
|
dir::AbstractString
|
||||||
julia_version::VersionNumber
|
julia_version::VersionNumber
|
||||||
ssh::Bool
|
ssh::Bool
|
||||||
|
manifest::Bool
|
||||||
plugins::Dict{DataType, Plugin}
|
plugins::Dict{DataType, Plugin}
|
||||||
|
|
||||||
function Template(;
|
function Template(;
|
||||||
@ -43,6 +45,7 @@ create a template, you can use [`interactive_template`](@ref) instead.
|
|||||||
dir::AbstractString=Pkg.devdir(),
|
dir::AbstractString=Pkg.devdir(),
|
||||||
julia_version::VersionNumber=VERSION,
|
julia_version::VersionNumber=VERSION,
|
||||||
ssh::Bool=false,
|
ssh::Bool=false,
|
||||||
|
manifest::Bool=false,
|
||||||
plugins::Vector{<:Plugin}=Plugin[],
|
plugins::Vector{<:Plugin}=Plugin[],
|
||||||
)
|
)
|
||||||
# Check for required Git options for package generation
|
# Check for required Git options for package generation
|
||||||
@ -79,7 +82,7 @@ create a template, you can use [`interactive_template`](@ref) instead.
|
|||||||
@warn "Plugin list contained duplicates, only the last of each type was kept"
|
@warn "Plugin list contained duplicates, only the last of each type was kept"
|
||||||
end
|
end
|
||||||
|
|
||||||
new(user, host, license, authors, dir, julia_version, ssh, plugin_dict)
|
new(user, host, license, authors, dir, julia_version, ssh, manifest, plugin_dict)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -101,6 +104,7 @@ function Base.show(io::IO, t::Template)
|
|||||||
println(io, "$spc→ Package directory: $(replace(maybe(t.dir), homedir() => "~"))")
|
println(io, "$spc→ Package directory: $(replace(maybe(t.dir), homedir() => "~"))")
|
||||||
println(io, "$spc→ Minimum Julia version: v$(version_floor(t.julia_version))")
|
println(io, "$spc→ Minimum Julia version: v$(version_floor(t.julia_version))")
|
||||||
println(io, "$spc→ SSH remote: $(t.ssh ? "Yes" : "No")")
|
println(io, "$spc→ SSH remote: $(t.ssh ? "Yes" : "No")")
|
||||||
|
println(io, "$spc→ Commit Manifest.toml: $(t.manifest ? "Yes" : "No")")
|
||||||
|
|
||||||
print(io, "$spc→ Plugins:")
|
print(io, "$spc→ Plugins:")
|
||||||
if isempty(t.plugins)
|
if isempty(t.plugins)
|
||||||
@ -130,7 +134,7 @@ function interactive_template(; fast::Bool=false)
|
|||||||
kwargs = Dict{Symbol, Any}()
|
kwargs = Dict{Symbol, Any}()
|
||||||
|
|
||||||
default_user = LibGit2.getconfig("github.user", "")
|
default_user = LibGit2.getconfig("github.user", "")
|
||||||
print("Enter your username [$(isempty(default_user) ? "REQUIRED" : default_user)]: ")
|
print("Username [$(isempty(default_user) ? "REQUIRED" : default_user)]: ")
|
||||||
user = readline()
|
user = readline()
|
||||||
kwargs[:user] = if !isempty(user)
|
kwargs[:user] = if !isempty(user)
|
||||||
user
|
user
|
||||||
@ -144,7 +148,7 @@ function interactive_template(; fast::Bool=false)
|
|||||||
"https://github.com"
|
"https://github.com"
|
||||||
else
|
else
|
||||||
default_host = "github.com"
|
default_host = "github.com"
|
||||||
print("Enter the code hosting service [$default_host]: ")
|
print("Code hosting service [$default_host]: ")
|
||||||
host = readline()
|
host = readline()
|
||||||
isempty(host) ? default_host : host
|
isempty(host) ? default_host : host
|
||||||
end
|
end
|
||||||
@ -152,7 +156,7 @@ function interactive_template(; fast::Bool=false)
|
|||||||
kwargs[:license] = if fast
|
kwargs[:license] = if fast
|
||||||
"MIT"
|
"MIT"
|
||||||
else
|
else
|
||||||
println("Select a license:")
|
println("License:")
|
||||||
io = IOBuffer()
|
io = IOBuffer()
|
||||||
available_licenses(io)
|
available_licenses(io)
|
||||||
licenses = ["" => "", collect(LICENSES)...]
|
licenses = ["" => "", collect(LICENSES)...]
|
||||||
@ -169,7 +173,7 @@ function interactive_template(; fast::Bool=false)
|
|||||||
else
|
else
|
||||||
default_authors = LibGit2.getconfig("user.name", "")
|
default_authors = LibGit2.getconfig("user.name", "")
|
||||||
default_str = isempty(default_authors) ? "None" : default_authors
|
default_str = isempty(default_authors) ? "None" : default_authors
|
||||||
print("Enter the package author(s) [$default_str]: ")
|
print("Package author(s) [$default_str]: ")
|
||||||
authors = readline()
|
authors = readline()
|
||||||
isempty(authors) ? default_authors : authors
|
isempty(authors) ? default_authors : authors
|
||||||
end
|
end
|
||||||
@ -178,7 +182,7 @@ function interactive_template(; fast::Bool=false)
|
|||||||
Pkg.devdir()
|
Pkg.devdir()
|
||||||
else
|
else
|
||||||
default_dir = Pkg.devdir()
|
default_dir = Pkg.devdir()
|
||||||
print("Enter the path to the package directory [$default_dir]: ")
|
print("Path to package directory [$default_dir]: ")
|
||||||
dir = readline()
|
dir = readline()
|
||||||
isempty(dir) ? default_dir : dir
|
isempty(dir) ? default_dir : dir
|
||||||
end
|
end
|
||||||
@ -187,7 +191,7 @@ function interactive_template(; fast::Bool=false)
|
|||||||
VERSION
|
VERSION
|
||||||
else
|
else
|
||||||
default_julia_version = VERSION
|
default_julia_version = VERSION
|
||||||
print("Enter the minimum Julia version [$(version_floor(default_julia_version))]: ")
|
print("Mminimum Julia version [$(version_floor(default_julia_version))]: ")
|
||||||
julia_version = readline()
|
julia_version = readline()
|
||||||
isempty(julia_version) ? default_julia_version : VersionNumber(julia_version)
|
isempty(julia_version) ? default_julia_version : VersionNumber(julia_version)
|
||||||
end
|
end
|
||||||
@ -196,10 +200,17 @@ function interactive_template(; fast::Bool=false)
|
|||||||
false
|
false
|
||||||
else
|
else
|
||||||
print("Set remote to SSH? [no]: ")
|
print("Set remote to SSH? [no]: ")
|
||||||
in(uppercase(readline()), ["Y", "YES", "T", "TRUE"])
|
uppercase(readline()) in ["Y", "YES", "T", "TRUE"]
|
||||||
end
|
end
|
||||||
|
|
||||||
println("Select plugins:")
|
kwargs[:manifest] = if fast
|
||||||
|
false
|
||||||
|
else
|
||||||
|
print("Commit Manifest.toml? [no]: ")
|
||||||
|
uppercase(readline()) in ["Y", "YES", "T", "TRUE"]
|
||||||
|
end
|
||||||
|
|
||||||
|
println("Plugins:")
|
||||||
# Only include plugin types which have an `interactive` method.
|
# Only include plugin types which have an `interactive` method.
|
||||||
plugin_types = filter(t -> hasmethod(interactive, (Type{t},)), fetch(plugin_types))
|
plugin_types = filter(t -> hasmethod(interactive, (Type{t},)), fetch(plugin_types))
|
||||||
type_names = map(t -> split(string(t), ".")[end], plugin_types)
|
type_names = map(t -> split(string(t), ".")[end], plugin_types)
|
||||||
|
Loading…
Reference in New Issue
Block a user