Fix tiny bugs

This commit is contained in:
Chris de Graaf 2017-08-14 21:39:14 -05:00
parent 5dc80dddc5
commit a40f5bea71
2 changed files with 14 additions and 16 deletions

View File

@ -63,7 +63,7 @@ function generate(pkg_name::AbstractString, t::Template; force::Bool=false)
end
LibGit2.add!(repo, files...)
info("Added files/directories to git: $(join(files, ", "))")
info("Staged $(length(files)) files/directories: $(join(files, ", "))")
LibGit2.commit(repo, "Files generated by PkgTemplates")
info("Committed files generated by PkgTemplates")
info("Finished")
@ -217,13 +217,15 @@ function gen_tests(pkg_dir::AbstractString)
end
"""
gen_file(file_path::AbstractString, text::AbstractString) -> Void
gen_file(file_path::AbstractString, text::AbstractString) -> Int
Create a new file containing some given text. Always ends the file with a newline.
# Arguments
* `file::AbstractString`: Path to the file to be created.
* `text::AbstractString`: Text to write to the file.
Returns the number of bytes written to the file.
"""
function gen_file(file::AbstractString, text::AbstractString)
mkpath(dirname(file))
@ -231,7 +233,7 @@ function gen_file(file::AbstractString, text::AbstractString)
text *= "\n"
end
open(file, "w") do fp
write(fp, text)
return write(fp, text)
end
end
@ -260,7 +262,7 @@ end
pkg_name::AbstractString,
pkg_template::Template;
view::Dict{String, Any}=Dict{String, Any}(),
)
) -> String
Replace placeholders in `template`. The input string is not modified.
@ -276,7 +278,7 @@ function substitute(
template::AbstractString,
pkg_name::AbstractString,
pkg_template::Template;
view::Dict{String, String}=Dict{String, String}(),
view::Dict{String, Any}=Dict{String, Any}(),
)
# Don't use version_floor here because we don't want the trailing '-' on prereleases.
d = merge!(Dict{String, Any}(), view)

View File

@ -34,22 +34,18 @@ Generate Markdown badges for the current package.
Returns an array of Markdown badges.
"""
function badges(_::GitHubPages, t::Template, pkg_name::AbstractString)
if haskey(t.plugins, TravisCI)
user = strip(URI(t.remote_prefix).path, '/')
return [
"[![stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://$user.github.io/$pkg_name.jl/stable)"
"[![latest](https://img.shields.io/badge/docs-latest-blue.svg)](https://$user.github.io/$pkg_name.jl/latest)"
]
end
return String[]
user = strip(URI(t.remote_prefix).path, '/')
return [
"[![stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://$user.github.io/$pkg_name.jl/stable)"
"[![latest](https://img.shields.io/badge/docs-latest-blue.svg)](https://$user.github.io/$pkg_name.jl/latest)"
]
end
"""
gen_plugin(plugin::GitHubPages, template::Template, pkg_name::AbstractString)
Generate the "docs" folder and set up direct HTML output from Documenter to be pushed to
GitHub Pages.
Generate the "docs" directory and set up direct HTML output from Documenter to be pushed
to GitHub Pages.
# Arguments
* `plugin::GitHubPages`: Plugin whose files are being generated.