Correctly log which files were committed

This commit is contained in:
Chris de Graaf 2018-11-09 15:18:09 -06:00
parent 973147639f
commit 2b02947bab
2 changed files with 11 additions and 3 deletions

View File

@ -145,7 +145,7 @@ function gen_tests(pkg_dir::AbstractString, t::Template)
""" """
gen_file(joinpath(pkg_dir, "test", "runtests.jl"), text) gen_file(joinpath(pkg_dir, "test", "runtests.jl"), text)
return ["Manifest.toml", "test/"] return ["test/"]
end end
""" """
@ -227,7 +227,9 @@ function gen_gitignore(pkg_dir::AbstractString, t::Template)
text = join(seen, "\n") text = join(seen, "\n")
gen_file(joinpath(pkg_dir, ".gitignore"), text) gen_file(joinpath(pkg_dir, ".gitignore"), text)
return [".gitignore"] files = [".gitignore"]
t.manifest && push!(files, "Manifest.toml")
return files
end end
""" """

View File

@ -205,11 +205,17 @@ end
gitignore = read(joinpath(pkg_dir, ".gitignore"), String) gitignore = read(joinpath(pkg_dir, ".gitignore"), String)
rm(joinpath(pkg_dir, ".gitignore")) rm(joinpath(pkg_dir, ".gitignore"))
@test occursin(".DS_Store", gitignore) @test occursin(".DS_Store", gitignore)
@test occursin("Manifest.toml", gitignore)
for p in values(t.plugins) for p in values(t.plugins)
for entry in p.gitignore for entry in p.gitignore
@test occursin(entry, gitignore) @test occursin(entry, gitignore)
end end
end end
t = Template(; user=me, manifest=true)
@test gen_gitignore(pkg_dir, t) == [".gitignore", "Manifest.toml"]
gitignore = read(joinpath(pkg_dir, ".gitignore"), String)
@test !occursin("Manifest.toml", gitignore)
rm(joinpath(pkg_dir, ".gitignore"))
# Test the license generation. # Test the license generation.
@test gen_license(pkg_dir, t) == ["LICENSE"] @test gen_license(pkg_dir, t) == ["LICENSE"]
@ -227,7 +233,7 @@ end
rm(joinpath(pkg_dir, "REQUIRE")) rm(joinpath(pkg_dir, "REQUIRE"))
# Test the test generation. # Test the test generation.
@test gen_tests(pkg_dir, t) == ["Manifest.toml", "test/"] @test gen_tests(pkg_dir, t) == ["test/"]
@test isfile(joinpath(pkg_dir, "Project.toml")) @test isfile(joinpath(pkg_dir, "Project.toml"))
project = read(joinpath(pkg_dir, "Project.toml"), String) project = read(joinpath(pkg_dir, "Project.toml"), String)
@test occursin("[extras]\nTest = ", project) @test occursin("[extras]\nTest = ", project)