Update documentation
This commit is contained in:
parent
d203ee39cd
commit
254b5e7e2f
@ -9,7 +9,7 @@ makedocs(
|
|||||||
"Plugins" => "pages/plugins.md",
|
"Plugins" => "pages/plugins.md",
|
||||||
"Plugin Development" => "pages/plugin_development.md",
|
"Plugin Development" => "pages/plugin_development.md",
|
||||||
"Licenses" => "pages/licenses.md",
|
"Licenses" => "pages/licenses.md",
|
||||||
"Index" => "pages/index.md"
|
"Index" => "pages/index.md",
|
||||||
],
|
],
|
||||||
repo="https://github.com/christopher-dG/PkgTemplates.jl/blob/{commit}{path}#L{line}",
|
repo="https://github.com/christopher-dG/PkgTemplates.jl/blob/{commit}{path}#L{line}",
|
||||||
sitename="PkgTemplates.jl",
|
sitename="PkgTemplates.jl",
|
||||||
|
@ -44,8 +44,8 @@ MyPkg.jl
|
|||||||
/home/degraafc/.julia/v0.6/MyPkg/test:
|
/home/degraafc/.julia/v0.6/MyPkg/test:
|
||||||
runtests.jl
|
runtests.jl
|
||||||
```
|
```
|
||||||
However, we can also configure a number of keyword arguments to `Template` and
|
However, we can also configure a number of keyword arguments to [`Template`](@ref) and
|
||||||
`generate`:
|
[`generate`](@ref):
|
||||||
|
|
||||||
```julia-repl
|
```julia-repl
|
||||||
julia> t = Template(;
|
julia> t = Template(;
|
||||||
|
@ -8,8 +8,16 @@ CurrentModule = PkgTemplates
|
|||||||
are available for use with `PkgTemplates`, but if you see that one is missing,
|
are available for use with `PkgTemplates`, but if you see that one is missing,
|
||||||
don't hesitate to open an issue or PR.
|
don't hesitate to open an issue or PR.
|
||||||
|
|
||||||
## show_license
|
## `show_license`
|
||||||
|
|
||||||
```@docs
|
```@docs
|
||||||
show_license
|
show_license
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Helper Functions
|
||||||
|
|
||||||
|
#### `read_license`
|
||||||
|
|
||||||
|
````@docs
|
||||||
|
read_license
|
||||||
|
```
|
||||||
|
@ -7,14 +7,51 @@ CurrentModule = PkgTemplates
|
|||||||
Creating new packages with `PkgTemplates` revolves around creating a new
|
Creating new packages with `PkgTemplates` revolves around creating a new
|
||||||
[`Template`](@ref), then calling [`generate`](@ref) on it.
|
[`Template`](@ref), then calling [`generate`](@ref) on it.
|
||||||
|
|
||||||
## Template
|
## `Template`
|
||||||
|
|
||||||
```@docs
|
```@docs
|
||||||
Template
|
Template
|
||||||
```
|
```
|
||||||
|
|
||||||
## generate
|
## `generate`
|
||||||
|
|
||||||
```@docs
|
```@docs
|
||||||
generate
|
generate
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Helper Functions
|
||||||
|
|
||||||
|
#### `gen_entrypoint`
|
||||||
|
|
||||||
|
```@docs
|
||||||
|
gen_entrypoint
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `gen_tests`
|
||||||
|
|
||||||
|
```@docs
|
||||||
|
gen_tests
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `gen_require`
|
||||||
|
|
||||||
|
```@docs
|
||||||
|
gen_require
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `gen_readme`
|
||||||
|
|
||||||
|
```@docs
|
||||||
|
gen_readme
|
||||||
|
```
|
||||||
|
|
||||||
|
#### gen_gitignore
|
||||||
|
|
||||||
|
```@docs
|
||||||
|
gen_gitignore
|
||||||
|
```
|
||||||
|
|
||||||
|
#### gen_license
|
||||||
|
```@docs
|
||||||
|
gen_license
|
||||||
|
```
|
||||||
|
@ -21,7 +21,7 @@ GenericPlugin
|
|||||||
CustomPlugin
|
CustomPlugin
|
||||||
```
|
```
|
||||||
|
|
||||||
### CustomPlugin required methods
|
### `CustomPlugin` required methods
|
||||||
|
|
||||||
#### `gen_plugin`
|
#### `gen_plugin`
|
||||||
|
|
||||||
@ -35,27 +35,33 @@ gen_plugin
|
|||||||
badges
|
badges
|
||||||
```
|
```
|
||||||
|
|
||||||
## Helper Functions
|
## Helper Types/Functions
|
||||||
|
|
||||||
#### gen_file
|
#### `gen_file`
|
||||||
|
|
||||||
```@docs
|
```@docs
|
||||||
gen_file
|
gen_file
|
||||||
```
|
```
|
||||||
|
|
||||||
#### substitute
|
#### `substitute`
|
||||||
|
|
||||||
```@docs
|
```@docs
|
||||||
substitute
|
substitute
|
||||||
```
|
```
|
||||||
|
|
||||||
#### badge
|
#### `Badge`
|
||||||
|
|
||||||
```@docs
|
```@docs
|
||||||
badge
|
Badge
|
||||||
```
|
```
|
||||||
|
|
||||||
#### version_floor
|
#### `format`
|
||||||
|
|
||||||
|
```@docs
|
||||||
|
format
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `version_floor`
|
||||||
|
|
||||||
```@docs
|
```@docs
|
||||||
version_floor
|
version_floor
|
||||||
|
@ -8,37 +8,37 @@ Plugins are the driver for `PkgTemplates`'s customization and extension. This pa
|
|||||||
describes plugins that already exist; for information on writing your own plugins, see the
|
describes plugins that already exist; for information on writing your own plugins, see the
|
||||||
[plugin development guide](https://invenia.github.io/PkgTemplates.jl/stable/pages/plugin_development.html).
|
[plugin development guide](https://invenia.github.io/PkgTemplates.jl/stable/pages/plugin_development.html).
|
||||||
|
|
||||||
## TravisCI
|
## `TravisCI`
|
||||||
|
|
||||||
```@docs
|
```@docs
|
||||||
TravisCI
|
TravisCI
|
||||||
```
|
```
|
||||||
|
|
||||||
## AppVeyor
|
## `AppVeyor`
|
||||||
|
|
||||||
```@docs
|
```@docs
|
||||||
AppVeyor
|
AppVeyor
|
||||||
```
|
```
|
||||||
|
|
||||||
## CodeCov
|
## `CodeCov`
|
||||||
|
|
||||||
```@docs
|
```@docs
|
||||||
CodeCov
|
CodeCov
|
||||||
```
|
```
|
||||||
|
|
||||||
## Coveralls
|
## `Coveralls`
|
||||||
|
|
||||||
```@docs
|
```@docs
|
||||||
Coveralls
|
Coveralls
|
||||||
```
|
```
|
||||||
|
|
||||||
## Documenter
|
## `Documenter`
|
||||||
|
|
||||||
```@docs
|
```@docs
|
||||||
Documenter
|
Documenter
|
||||||
```
|
```
|
||||||
|
|
||||||
## GitHubPages
|
## `GitHubPages`
|
||||||
|
|
||||||
```@docs
|
```@docs
|
||||||
GitHubPages
|
GitHubPages
|
||||||
|
150
src/generate.jl
150
src/generate.jl
@ -9,7 +9,7 @@
|
|||||||
Generate a package from a template.
|
Generate a package from a template.
|
||||||
|
|
||||||
# Arguments
|
# Arguments
|
||||||
* `pkg_name::AbstractString`: Name of the package.
|
* `pkg_name::AbstractString`: Name of the package (with or without trailing ".jl").
|
||||||
* `t::Template`: The template from which to generate the package.
|
* `t::Template`: The template from which to generate the package.
|
||||||
|
|
||||||
# Keyword Arguments
|
# Keyword Arguments
|
||||||
@ -83,6 +83,72 @@ function generate(
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
"""
|
||||||
|
gen_entrypoint(pkg_name::AbstractString, template::Template) -> Vector{String}
|
||||||
|
|
||||||
|
Create the module entrypoint in the temp package directory.
|
||||||
|
|
||||||
|
# Arguments
|
||||||
|
* `pkg_name::AbstractString`: Name of the package.
|
||||||
|
* `template::Template`: The template whose entrypoint we are generating.
|
||||||
|
|
||||||
|
Returns an array of generated file/directory names.
|
||||||
|
"""
|
||||||
|
function gen_entrypoint(pkg_name::AbstractString, template::Template)
|
||||||
|
text = """
|
||||||
|
module $pkg_name
|
||||||
|
|
||||||
|
# Package code goes here.
|
||||||
|
|
||||||
|
end
|
||||||
|
"""
|
||||||
|
|
||||||
|
gen_file(joinpath(template.temp_dir, pkg_name, "src", "$pkg_name.jl"), text)
|
||||||
|
return ["src/"]
|
||||||
|
end
|
||||||
|
|
||||||
|
"""
|
||||||
|
gen_tests(pkg_name::AbstractString, template::Template) -> Vector{String}
|
||||||
|
|
||||||
|
Create the test directory and entrypoint in the temp package directory.
|
||||||
|
|
||||||
|
# Arguments
|
||||||
|
* `pkg_name::AbstractString`: Name of the package.
|
||||||
|
* `template::Template`: The template whose tests we are generating.
|
||||||
|
|
||||||
|
Returns an array of generated file/directory names.
|
||||||
|
"""
|
||||||
|
function gen_tests(pkg_name::AbstractString, template::Template)
|
||||||
|
text = """
|
||||||
|
using $pkg_name
|
||||||
|
using Base.Test
|
||||||
|
|
||||||
|
# Write your own tests here.
|
||||||
|
@test 1 == 2
|
||||||
|
"""
|
||||||
|
|
||||||
|
gen_file(joinpath(template.temp_dir, pkg_name, "test", "runtests.jl"), text)
|
||||||
|
return ["test/"]
|
||||||
|
end
|
||||||
|
|
||||||
|
"""
|
||||||
|
gen_require(pkg_name::AbstractString, template::Template) -> Vector{String}
|
||||||
|
|
||||||
|
Create the `REQUIRE` file in the temp package directory.
|
||||||
|
|
||||||
|
# Arguments
|
||||||
|
* `pkg_name::AbstractString`: Name of the package.
|
||||||
|
* `template::Template`: The template whose REQUIRE we are generating.
|
||||||
|
|
||||||
|
Returns an array of generated file/directory names.
|
||||||
|
"""
|
||||||
|
function gen_require(pkg_name::AbstractString, template::Template)
|
||||||
|
text = "julia $(version_floor(template.julia_version))\n"
|
||||||
|
|
||||||
|
gen_file(joinpath(template.temp_dir, pkg_name, "REQUIRE"), text)
|
||||||
|
return ["REQUIRE"]
|
||||||
|
end
|
||||||
|
|
||||||
"""
|
"""
|
||||||
gen_readme(pkg_name::AbstractString, template::Template) -> Vector{String}
|
gen_readme(pkg_name::AbstractString, template::Template) -> Vector{String}
|
||||||
|
|
||||||
@ -124,7 +190,7 @@ end
|
|||||||
"""
|
"""
|
||||||
gen_gitignore(pkg_name::AbstractString, template::Template) -> Vector{String}
|
gen_gitignore(pkg_name::AbstractString, template::Template) -> Vector{String}
|
||||||
|
|
||||||
Create a .gitignore in the temp package directory.
|
Create a `.gitignore` in the temp package directory.
|
||||||
|
|
||||||
# Arguments
|
# Arguments
|
||||||
* `pkg_name::AbstractString`: Name of the package.
|
* `pkg_name::AbstractString`: Name of the package.
|
||||||
@ -150,7 +216,7 @@ end
|
|||||||
"""
|
"""
|
||||||
gen_license(pkg_name::AbstractString, template::Template) -> Vector{String}
|
gen_license(pkg_name::AbstractString, template::Template) -> Vector{String}
|
||||||
|
|
||||||
Create a LICENSE in the temp package directory.
|
Create a license in the temp package directory.
|
||||||
|
|
||||||
# Arguments
|
# Arguments
|
||||||
* `pkg_name::AbstractString`: Name of the package.
|
* `pkg_name::AbstractString`: Name of the package.
|
||||||
@ -170,72 +236,6 @@ function gen_license(pkg_name::AbstractString, template::Template)
|
|||||||
return ["LICENSE"]
|
return ["LICENSE"]
|
||||||
end
|
end
|
||||||
|
|
||||||
"""
|
|
||||||
gen_entrypoint(pkg_name::AbstractString, template::Template) -> Vector{String}
|
|
||||||
|
|
||||||
Create the module entrypoint in the temp package directory.
|
|
||||||
|
|
||||||
# Arguments
|
|
||||||
* `pkg_name::AbstractString`: Name of the package.
|
|
||||||
* `template::Template`: The template whose entrypoint we are generating.
|
|
||||||
|
|
||||||
Returns an array of generated file/directory names.
|
|
||||||
"""
|
|
||||||
function gen_entrypoint(pkg_name::AbstractString, template::Template)
|
|
||||||
text = """
|
|
||||||
module $pkg_name
|
|
||||||
|
|
||||||
# Package code goes here.
|
|
||||||
|
|
||||||
end
|
|
||||||
"""
|
|
||||||
|
|
||||||
gen_file(joinpath(template.temp_dir, pkg_name, "src", "$pkg_name.jl"), text)
|
|
||||||
return ["src/"]
|
|
||||||
end
|
|
||||||
|
|
||||||
"""
|
|
||||||
gen_require(pkg_name::AbstractString, template::Template) -> Vector{String}
|
|
||||||
|
|
||||||
Create the REQUIRE file in the temp package directory.
|
|
||||||
|
|
||||||
# Arguments
|
|
||||||
* `pkg_name::AbstractString`: Name of the package.
|
|
||||||
* `template::Template`: The template whose REQUIRE we are generating.
|
|
||||||
|
|
||||||
Returns an array of generated file/directory names.
|
|
||||||
"""
|
|
||||||
function gen_require(pkg_name::AbstractString, template::Template)
|
|
||||||
text = "julia $(version_floor(template.julia_version))\n"
|
|
||||||
|
|
||||||
gen_file(joinpath(template.temp_dir, pkg_name, "REQUIRE"), text)
|
|
||||||
return ["REQUIRE"]
|
|
||||||
end
|
|
||||||
|
|
||||||
"""
|
|
||||||
gen_tests(pkg_name::AbstractString, template::Template) -> Vector{String}
|
|
||||||
|
|
||||||
Create the test directory and entrypoint in the temp package directory.
|
|
||||||
|
|
||||||
# Arguments
|
|
||||||
* `pkg_name::AbstractString`: Name of the package.
|
|
||||||
* `template::Template`: The template whose tests we are generating.
|
|
||||||
|
|
||||||
Returns an array of generated file/directory names.
|
|
||||||
"""
|
|
||||||
function gen_tests(pkg_name::AbstractString, template::Template)
|
|
||||||
text = """
|
|
||||||
using $pkg_name
|
|
||||||
using Base.Test
|
|
||||||
|
|
||||||
# Write your own tests here.
|
|
||||||
@test 1 == 2
|
|
||||||
"""
|
|
||||||
|
|
||||||
gen_file(joinpath(template.temp_dir, pkg_name, "test", "runtests.jl"), text)
|
|
||||||
return ["test/"]
|
|
||||||
end
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
gen_file(file_path::AbstractString, text::AbstractString) -> Int
|
gen_file(file_path::AbstractString, text::AbstractString) -> Int
|
||||||
|
|
||||||
@ -279,13 +279,7 @@ end
|
|||||||
"""
|
"""
|
||||||
substitute(template::AbstractString, view::Dict{String, Any}) -> String
|
substitute(template::AbstractString, view::Dict{String, Any}) -> String
|
||||||
|
|
||||||
Replace placeholders in a template string. The input string is not modified.
|
Replace placeholders in `template` with values in `view`. `template` is not modified.
|
||||||
|
|
||||||
# Arguments
|
|
||||||
* `template::AbstracString`: Template string in which to make replacements.
|
|
||||||
* `view::Dict{String, Any}`: (Placeholder => value) pairs.
|
|
||||||
|
|
||||||
Returns the template string with replacements applied.
|
|
||||||
|
|
||||||
# Notes
|
# Notes
|
||||||
Due to a bug in `Mustache`, conditionals often insert undesired newlines (more detail
|
Due to a bug in `Mustache`, conditionals often insert undesired newlines (more detail
|
||||||
@ -321,8 +315,8 @@ substitute(template::AbstractString, view::Dict{String, Any}) = render(template,
|
|||||||
view::Dict{String, Any}=Dict{String, Any}(),
|
view::Dict{String, Any}=Dict{String, Any}(),
|
||||||
) -> String
|
) -> String
|
||||||
|
|
||||||
Replace placeholders in template string, using some default replacements based on the
|
Replace placeholders in `template`, using some default replacements based on the
|
||||||
package template. The input string is not modified.
|
`pkg_template` and additional ones in `view`. `template` is not modified.
|
||||||
"""
|
"""
|
||||||
function substitute(
|
function substitute(
|
||||||
template::AbstractString,
|
template::AbstractString,
|
||||||
|
Loading…
Reference in New Issue
Block a user