Update documentation

This commit is contained in:
Chris de Graaf 2017-08-18 02:08:11 -05:00
parent c245bcd556
commit 3cf0ce6652
9 changed files with 68 additions and 70 deletions

View File

@ -31,18 +31,16 @@ INFO: Made initial empty commit
INFO: Set remote origin to https://github.com/invenia/MyPkg.jl INFO: Set remote origin to https://github.com/invenia/MyPkg.jl
INFO: Staged 5 files/directories: src/, test/, REQUIRE, .gitignore, README.md INFO: Staged 5 files/directories: src/, test/, REQUIRE, .gitignore, README.md
INFO: Committed files generated by PkgTemplates INFO: Committed files generated by PkgTemplates
INFO: Copying temporary package directory into /home/degraafc/.julia/v0.6/ INFO: Moving temporary package directory into /home/degraafc/.julia/v0.6/
INFO: Finished INFO: Finished
julia> run(`ls -R $(Pkg.dir("MyPkg"))`) julia> cd(joinpath(t.dir, "MyPkg")); run(`git ls-tree -r --name-only HEAD`)
/home/degraafc/.julia/v0.6/MyPkg: .gitignore
README.md REQUIRE src test .travis.yml
README.md
/home/degraafc/.julia/v0.6/MyPkg/src: REQUIRE
MyPkg.jl src/MyPkg.jl
test/runtests.jl
/home/degraafc/.julia/v0.6/MyPkg/test:
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` and
`generate`: `generate`:
@ -55,10 +53,12 @@ julia> t = Template(;
years="2016-2017", years="2016-2017",
dir=joinpath(ENV["HOME"], "code"), dir=joinpath(ENV["HOME"], "code"),
julia_version=v"0.5.2", julia_version=v"0.5.2",
requirements=["PkgTemplates"],
git_config=Dict("diff.renames" => true), git_config=Dict("diff.renames" => true),
plugins=[ plugins=[
TravisCI(), TravisCI(),
CodeCov(; config_file=nothing), CodeCov(; config_file=nothing),
Coveralls(),
AppVeyor(), AppVeyor(),
GitHubPages(; assets=[joinpath(ENV["HOME"], "invenia.css")]), GitHubPages(; assets=[joinpath(ENV["HOME"], "invenia.css")]),
], ],
@ -72,9 +72,22 @@ INFO: Set remote origin to git@github.com:invenia/MyPkg.jl.git
INFO: Created empty gh-pages branch INFO: Created empty gh-pages branch
INFO: Staged 9 files/directories: src/, test/, REQUIRE, README.md, .gitignore, LICENSE, .travis.yml, .appveyor.yml, docs/ INFO: Staged 9 files/directories: src/, test/, REQUIRE, README.md, .gitignore, LICENSE, .travis.yml, .appveyor.yml, docs/
INFO: Committed files generated by PkgTemplates INFO: Committed files generated by PkgTemplates
INFO: Copying temporary package directory into /home/degraafc/code/ INFO: Moving temporary package directory into /home/degraafc/code/
INFO: Finished INFO: Finished
WARNING: Remember to push all created branches to your remote: git push --all WARNING: Remember to push all created branches to your remote: git push --all
julia> cd(joinpath(t.dir, "MyPkg")); run(`git ls-tree -r --name-only HEAD`)
.appveyor.yml
.gitignore
.travis.yml
LICENSE
README.md
REQUIRE
docs/make.jl
docs/src/assets/invenia.css
docs/src/index.md
src/MyPkg.jl
test/runtests.jl
``` ```
Information on each keyword as well as plugin types can be found in the Information on each keyword as well as plugin types can be found in the

View File

@ -20,61 +20,37 @@ repeatable, and customizable way.**
The simplest template only requires your GitHub username. The simplest template only requires your GitHub username.
```julia-repl ```@repl
julia> using PkgTemplates using PkgTemplates
t = Template(; user="invenia")
julia> t = Template(; user="invenia") generate("MyPkg", t)
cd(joinpath(t.dir, "MyPkg")); run(`git ls-tree -r --name-only HEAD`)
julia> generate("MyPkg", t)
INFO: Initialized git repo at /tmp/tmpvaHVki/MyPkg
INFO: Made initial empty commit
INFO: Set remote origin to https://github.com/invenia/MyPkg.jl
INFO: Staged 5 files/directories: src/, test/, REQUIRE, .gitignore, README.md
INFO: Committed files generated by PkgTemplates
INFO: Copying temporary package directory into /home/degraafc/.julia/v0.6/
INFO: Finished
julia> run(`ls -R $(Pkg.dir("MyPkg"))`)
/home/degraafc/.julia/v0.6/MyPkg:
README.md REQUIRE src test
/home/degraafc/.julia/v0.6/MyPkg/src:
MyPkg.jl
/home/degraafc/.julia/v0.6/MyPkg/test:
runtests.jl
``` ```
However, we can also configure a number of keyword arguments to [`Template`](@ref) and However, we can also configure a number of keyword arguments to [`Template`](@ref) and
[`generate`](@ref): [`generate`](@ref):
```julia-repl ```@repl
julia> t = Template(; using PkgTemplates
t = Template(;
user="invenia", user="invenia",
license="MIT", license="MIT",
authors=["Chris de Graaf", "Invenia Technical Computing Corporation"], authors=["Chris de Graaf", "Invenia Technical Computing Corporation"],
years="2016-2017", years="2016-2017",
dir=joinpath(ENV["HOME"], "code"), dir=joinpath(ENV["HOME"], "code"),
julia_version=v"0.5.2", julia_version=v"0.5.2",
requirements=["PkgTemplates"],
git_config=Dict("diff.renames" => true), git_config=Dict("diff.renames" => true),
plugins=[ plugins=[
TravisCI(), TravisCI(),
CodeCov(; config_file=nothing), CodeCov(; config_file=nothing),
Coveralls(),
AppVeyor(), AppVeyor(),
GitHubPages(; assets=[joinpath(ENV["HOME"], "invenia.css")]), GitHubPages(; assets=[joinpath(ENV["HOME"], "invenia.css")]),
], ],
) )
generate("MyPkg", t; force=true, ssh=true)
julia> generate("MyPkg", t; force=true, ssh=true) cd(joinpath(t.dir, "MyPkg")); run(`git ls-tree -r --name-only HEAD`)
INFO: Initialized git repo at /tmp/tmpe0dWY5/MyPkg
INFO: Applying git configuration
INFO: Made initial empty commit
INFO: Set remote origin to git@github.com:invenia/MyPkg.jl.git
INFO: Created empty gh-pages branch
INFO: Staged 9 files/directories: src/, test/, REQUIRE, README.md, .gitignore, LICENSE, .travis.yml, .appveyor.yml, docs/
INFO: Committed files generated by PkgTemplates
INFO: Copying temporary package directory into /home/degraafc/code/
INFO: Finished
WARNING: Remember to push all created branches to your remote: git push --all
``` ```
## Comparison to [PkgDev](https://github.com/JuliaLang/PkgDev.jl) ## Comparison to [PkgDev](https://github.com/JuliaLang/PkgDev.jl)

View File

@ -18,6 +18,6 @@ show_license
#### `read_license` #### `read_license`
````@docs ```@docs
read_license read_license
``` ```

View File

@ -5,8 +5,8 @@ CurrentModule = PkgTemplates
# Plugins # Plugins
Plugins are the driver for `PkgTemplates`'s customization and extension. This page Plugins are the driver for `PkgTemplates`'s customization and extension. This page
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
[plugin development guide](https://invenia.github.io/PkgTemplates.jl/stable/pages/plugin_development.html). [Plugin Development](@ref).
## `TravisCI` ## `TravisCI`

View File

@ -15,6 +15,12 @@ Generate a package from a template.
# Keyword Arguments # Keyword Arguments
* `force::Bool=false`: Whether or not to overwrite old packages with the same name. * `force::Bool=false`: Whether or not to overwrite old packages with the same name.
* `ssh::Bool=false`: Whether or not to use SSH for the remote. * `ssh::Bool=false`: Whether or not to use SSH for the remote.
# Notes
The package is generated entirely in a temporary directory (`t.temp_dir`), and only moved
into `joinpath(t.dir, pkg_name)` at the very end. In the case of an error, the temporary
directory will contain leftovers, but the destination directory will remain untouched
(this is especially helpful when `force=true`).
""" """
function generate( function generate(
pkg_name::AbstractString, pkg_name::AbstractString,
@ -74,7 +80,7 @@ function generate(
LibGit2.commit(repo, "Files generated by PkgTemplates") LibGit2.commit(repo, "Files generated by PkgTemplates")
info("Committed files generated by PkgTemplates") info("Committed files generated by PkgTemplates")
multiple_branches = length(collect(LibGit2.GitBranchIter(repo))) > 1 multiple_branches = length(collect(LibGit2.GitBranchIter(repo))) > 1
info("Copying temporary package directory into $(t.dir)/") info("Moving temporary package directory into $(t.dir)/")
mv(temp_pkg_dir, pkg_dir; remove_destination=force) mv(temp_pkg_dir, pkg_dir; remove_destination=force)
rm(t.temp_dir; recursive=true) rm(t.temp_dir; recursive=true)
info("Finished") info("Finished")

View File

@ -1,5 +1,5 @@
""" """
AppVeyor(; config_file::Union{AbstractString, Void}="") -> GenericPlugin AppVeyor(; config_file::Union{AbstractString, Void}="") -> AppVeyor
Add `AppVeyor` to a template's plugins to add a `.appveyor.yml` configuration file to Add `AppVeyor` to a template's plugins to add a `.appveyor.yml` configuration file to
generated repositories, and an appropriate badge to the README. generated repositories, and an appropriate badge to the README.

View File

@ -1,5 +1,5 @@
""" """
CodeCov(; config_file::Union{AbstractString, Void}="") -> GenericPlugin CodeCov(; config_file::Union{AbstractString, Void}="") -> CodeCov
Add `CodeCov` to a template's plugins to add a `.codecov.yml` configuration file to Add `CodeCov` to a template's plugins to add a `.codecov.yml` configuration file to
generated repositories, and an appropriate badge to the README. Also updates the generated repositories, and an appropriate badge to the README. Also updates the

View File

@ -1,5 +1,5 @@
""" """
TravisCI(; config_file::Union{AbstractString, Void}="") -> GenericPlugin TravisCI(; config_file::Union{AbstractString, Void}="") -> TravisCI
Add `TravisCI` to a template's plugins to add a `.travis.yml` configuration file to Add `TravisCI` to a template's plugins to add a `.travis.yml` configuration file to
generated repositories, and an appropriate badge to the README. generated repositories, and an appropriate badge to the README.

View File

@ -9,7 +9,10 @@ Records common information used to generate a package.
value. If neither is set, an `ArgumentError` is thrown. value. If neither is set, an `ArgumentError` is thrown.
**This is case-sensitive for some plugins, so take care to enter it correctly.** **This is case-sensitive for some plugins, so take care to enter it correctly.**
* `host::AbstractString="github.com"`: URL to the code hosting service where your package * `host::AbstractString="github.com"`: URL to the code hosting service where your package
will reside. will reside. Note that while hosts other than GitHub won't cause errors, they are not
officially supported and they will cause certain plugins will produce incorrect output.
For example, [`AppVeyor`](@ref)'s badge image will point to a GitHub-specific URL,
regardless of the value of `host`.
* `license::Union{AbstractString, Void}=nothing`: Name of the package license. If * `license::Union{AbstractString, Void}=nothing`: Name of the package license. If
no license is specified, no license is created. [`show_license`](@ref) can be used to no license is specified, no license is created. [`show_license`](@ref) can be used to
list all available licenses, or to print out a particular license's text. list all available licenses, or to print out a particular license's text.