From 19a972b4dfb8accd7218703afd116be47de1cb7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Besan=C3=A7on?= Date: Wed, 15 May 2019 09:50:54 +0200 Subject: [PATCH] file layout --- src/generate.jl | 2 +- src/plugins/citation.jl | 18 ++++++++++-------- test/plugins/citation.jl | 13 +++++++++++-- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/generate.jl b/src/generate.jl index d021c25..d73dbb5 100644 --- a/src/generate.jl +++ b/src/generate.jl @@ -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 diff --git a/src/plugins/citation.jl b/src/plugins/citation.jl index ce3a07a..9dea315 100644 --- a/src/plugins/citation.jl +++ b/src/plugins/citation.jl @@ -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 diff --git a/test/plugins/citation.jl b/test/plugins/citation.jl index d47d2f8..888660f 100644 --- a/test/plugins/citation.jl +++ b/test/plugins/citation.jl @@ -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