file layout
This commit is contained in:
parent
fc46d0a33e
commit
19a972b4df
@ -217,7 +217,7 @@ function gen_readme(pkg_dir::AbstractString, t::Template)
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
if haskey(t.plugins, Citation) && t.plugins[Citation].readme_section
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,14 +30,16 @@ interactive(::Type{Citation}) = interactive(Citation; readme_section=false)
|
|||||||
|
|
||||||
function gen_plugin(p::Citation, t::Template, pkg_name::AbstractString)
|
function gen_plugin(p::Citation, t::Template, pkg_name::AbstractString)
|
||||||
pkg_dir = joinpath(t.dir, pkg_name)
|
pkg_dir = joinpath(t.dir, pkg_name)
|
||||||
text = """@misc{$pkg_name.jl,
|
text = """
|
||||||
\tauthor = {{$(t.authors)}},\n
|
@misc{$pkg_name.jl,
|
||||||
\ttitle = {{$(pkg_name).jl}},\n
|
\tauthor = {$(t.authors)},
|
||||||
\turl = {https://$(t.host)/$(t.user)/$(pkg_name).jl},\n
|
\ttitle = {{$(pkg_name).jl}},
|
||||||
\tversion = {v0.0.1},\n
|
\turl = {https://$(t.host)/$(t.user)/$(pkg_name).jl},
|
||||||
\tyear = {$(year(today()))},\n
|
\tversion = {v0.1.0},
|
||||||
\tmonth = {$(month(today()))}\n
|
\tyear = {$(year(today()))},
|
||||||
}\n"""
|
\tmonth = {$(month(today()))}
|
||||||
|
}
|
||||||
|
"""
|
||||||
gen_file(joinpath(pkg_dir, "CITATION.bib"), text)
|
gen_file(joinpath(pkg_dir, "CITATION.bib"), text)
|
||||||
return ["CITATION.bib"]
|
return ["CITATION.bib"]
|
||||||
end
|
end
|
||||||
|
@ -14,7 +14,6 @@ pkg_dir = joinpath(t.dir, test_pkg)
|
|||||||
end
|
end
|
||||||
|
|
||||||
@testset "File generation" begin
|
@testset "File generation" begin
|
||||||
# Without a coverage plugin in the template, there should be no post-test step.
|
|
||||||
p = Citation()
|
p = Citation()
|
||||||
@test gen_plugin(p, t, test_pkg) == ["CITATION.bib"]
|
@test gen_plugin(p, t, test_pkg) == ["CITATION.bib"]
|
||||||
@test isfile(joinpath(pkg_dir, "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("@misc", citation)
|
||||||
@test occursin("$(t.authors)", 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
|
end
|
||||||
|
|
||||||
@testset "Readme modification" begin
|
@testset "Readme modification" begin
|
||||||
|
Loading…
Reference in New Issue
Block a user