file layout
This commit is contained in:
parent
fc46d0a33e
commit
19a972b4df
@ -217,7 +217,7 @@ function gen_readme(pkg_dir::AbstractString, t::Template)
|
||||
)
|
||||
end
|
||||
if haskey(t.plugins, Citation) && t.plugins[Citation].readme_section
|
||||
text *= "\n## Citing\n\nSee `CITATION.bib` for the relevant reference(s)\n"
|
||||
text *= "\n## Citing\n\nSee `CITATION.bib` for the relevant reference(s).\n"
|
||||
end
|
||||
|
||||
|
||||
|
@ -30,14 +30,16 @@ interactive(::Type{Citation}) = interactive(Citation; readme_section=false)
|
||||
|
||||
function gen_plugin(p::Citation, t::Template, pkg_name::AbstractString)
|
||||
pkg_dir = joinpath(t.dir, pkg_name)
|
||||
text = """@misc{$pkg_name.jl,
|
||||
\tauthor = {{$(t.authors)}},\n
|
||||
\ttitle = {{$(pkg_name).jl}},\n
|
||||
\turl = {https://$(t.host)/$(t.user)/$(pkg_name).jl},\n
|
||||
\tversion = {v0.0.1},\n
|
||||
\tyear = {$(year(today()))},\n
|
||||
\tmonth = {$(month(today()))}\n
|
||||
}\n"""
|
||||
text = """
|
||||
@misc{$pkg_name.jl,
|
||||
\tauthor = {$(t.authors)},
|
||||
\ttitle = {{$(pkg_name).jl}},
|
||||
\turl = {https://$(t.host)/$(t.user)/$(pkg_name).jl},
|
||||
\tversion = {v0.1.0},
|
||||
\tyear = {$(year(today()))},
|
||||
\tmonth = {$(month(today()))}
|
||||
}
|
||||
"""
|
||||
gen_file(joinpath(pkg_dir, "CITATION.bib"), text)
|
||||
return ["CITATION.bib"]
|
||||
end
|
||||
|
@ -14,7 +14,6 @@ pkg_dir = joinpath(t.dir, test_pkg)
|
||||
end
|
||||
|
||||
@testset "File generation" begin
|
||||
# Without a coverage plugin in the template, there should be no post-test step.
|
||||
p = Citation()
|
||||
@test gen_plugin(p, t, test_pkg) == ["CITATION.bib"]
|
||||
@test isfile(joinpath(pkg_dir, "CITATION.bib"))
|
||||
@ -22,7 +21,17 @@ pkg_dir = joinpath(t.dir, test_pkg)
|
||||
|
||||
@test occursin("@misc", citation)
|
||||
@test occursin("$(t.authors)", citation)
|
||||
@test occursin("v0.0.1", citation)
|
||||
@test occursin("v0.1.0", citation)
|
||||
end
|
||||
|
||||
@testset "Readme untouched" begin
|
||||
p = Citation(; readme_section=false)
|
||||
t.plugins[Citation] = p
|
||||
isdir(pkg_dir) && rm(pkg_dir; recursive=true)
|
||||
generate(test_pkg, t, git=false)
|
||||
readme = read(joinpath(pkg_dir, "README.md"), String)
|
||||
@test !occursin("## Citing", readme)
|
||||
@test !occursin("CITATION.bib", readme)
|
||||
end
|
||||
|
||||
@testset "Readme modification" begin
|
||||
|
Loading…
Reference in New Issue
Block a user