PkgTemplates.jl/README.md

120 lines
4.4 KiB
Markdown
Raw Normal View History

2017-08-10 17:13:01 +00:00
# PkgTemplates
2017-08-15 14:19:37 +00:00
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://invenia.github.io/PkgTemplates.jl/stable)
[![Latest](https://img.shields.io/badge/docs-latest-blue.svg)](https://invenia.github.io/PkgTemplates.jl/latest)
[![Build Status](https://travis-ci.org/invenia/PkgTemplates.jl.svg?branch=master)](https://travis-ci.org/invenia/PkgTemplates.jl)
2017-08-25 04:00:22 +00:00
[![Build Status](https://ci.appveyor.com/api/projects/status/r24xamruqlm88uti?svg=true)](https://ci.appveyor.com/project/christopher-dG/PkgTemplates-jl)
[![CodeCov](https://codecov.io/gh/invenia/PkgTemplates.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/invenia/PkgTemplates.jl)
2017-08-16 06:12:42 +00:00
**PkgTemplates is a Julia package for creating new Julia packages in an easy,
repeatable, and customizable way.**
## Installation
`PkgTemplates` is registered in
[`METADATA.jl`](https://github.com/JuliaLang/METADATA.jl), so run
`Pkg.add("PkgTemplates")` for the latest release, or
`Pkg.clone("PkgTemplates")` for the development version.
2017-08-16 06:12:42 +00:00
## Usage
The simplest template only requires your GitHub username.
```julia
julia> using PkgTemplates
2017-10-27 14:31:34 +00:00
julia> t = Template(; user="myusername");
2017-08-16 06:12:42 +00:00
2017-08-16 23:11:20 +00:00
julia> generate("MyPkg", t)
2017-08-16 06:12:42 +00:00
INFO: Initialized git repo at /tmp/tmpvaHVki/MyPkg
2017-10-27 14:31:34 +00:00
INFO: Made empty initial commit
INFO: Set remote origin to https://github.com/myusername/MyPkg.jl
2017-10-27 14:31:34 +00:00
INFO: Staged 6 files/directories: src/, test/, REQUIRE, README.md, .gitignore, LICENSE
2017-08-16 06:12:42 +00:00
INFO: Committed files generated by PkgTemplates
2017-10-27 14:31:34 +00:00
INFO: Moved temporary package directory into /home/degraafc/.julia/v0.6/
2017-08-16 06:12:42 +00:00
INFO: Finished
2017-10-27 14:31:34 +00:00
julia> run(`git -C $(joinpath(t.dir, "MyPkg")) ls-tree -r --name-only HEAD`)
2017-08-18 07:08:11 +00:00
.gitignore
2017-10-27 14:31:34 +00:00
LICENSE
2017-08-18 07:08:11 +00:00
README.md
REQUIRE
src/MyPkg.jl
test/runtests.jl
2017-08-16 06:12:42 +00:00
```
However, we can also configure a number of keyword arguments to `Template` and
`generate`:
```julia
julia> t = Template(;
user="myusername",
2017-10-27 14:31:34 +00:00
license="ISC",
2017-08-16 06:12:42 +00:00
authors=["Chris de Graaf", "Invenia Technical Computing Corporation"],
years="2016-2017",
2017-08-21 19:52:50 +00:00
dir=joinpath(homedir(), "code"),
2017-08-16 06:12:42 +00:00
julia_version=v"0.5.2",
2017-08-18 07:08:11 +00:00
requirements=["PkgTemplates"],
2017-08-23 17:50:52 +00:00
gitconfig=Dict("diff.renames" => true),
2017-08-16 06:12:42 +00:00
plugins=[
TravisCI(),
2017-10-27 14:31:34 +00:00
CodeCov(),
2017-08-18 07:08:11 +00:00
Coveralls(),
2017-08-16 06:12:42 +00:00
AppVeyor(),
2017-08-25 13:59:50 +00:00
GitHubPages(),
2017-08-16 06:12:42 +00:00
],
2017-10-27 14:31:34 +00:00
);
2017-08-16 06:12:42 +00:00
julia> generate("MyPkg", t; force=true, ssh=true)
INFO: Initialized git repo at /tmp/tmpe0dWY5/MyPkg
2017-10-27 14:31:34 +00:00
INFO: Applied git configuration
INFO: Made empty initial commit
INFO: Set remote origin to git@github.com:myusername/MyPkg.jl.git
2017-08-16 06:12:42 +00:00
INFO: Created empty gh-pages branch
2017-10-27 14:31:34 +00:00
INFO: Staged 9 files/directories: src/, test/, REQUIRE, README.md, .gitignore, LICENSE, docs/, .appveyor.yml, .travis.yml
2017-08-16 06:12:42 +00:00
INFO: Committed files generated by PkgTemplates
2017-10-27 14:31:34 +00:00
INFO: Moved temporary package directory into /home/degraafc/code/
2017-08-16 06:12:42 +00:00
INFO: Finished
WARNING: Remember to push all created branches to your remote: git push --all
2017-08-18 07:08:11 +00:00
2017-10-27 14:31:34 +00:00
julia> run(`git -C $(joinpath(t.dir, "MyPkg")) ls-tree -r --name-only HEAD`)
2017-08-25 04:00:22 +00:00
.appveyor.yml
2017-08-18 07:08:11 +00:00
.gitignore
.travis.yml
LICENSE
README.md
REQUIRE
docs/make.jl
docs/src/index.md
src/MyPkg.jl
test/runtests.jl
2017-08-16 06:12:42 +00:00
```
Information on each keyword as well as plugin types can be found in the
[documentation](https://invenia.github.io/PkgTemplates.jl/stable).
2017-08-22 20:13:25 +00:00
If that looks like a lot of work, you can also create templates interactively
with `interactive_template`:
[![asciicast](https://asciinema.org/a/bqBwff05mI7Cl9bz7EqLPMKF8.png)](https://asciinema.org/a/bqBwff05mI7Cl9bz7EqLPMKF8)
2017-08-22 20:13:25 +00:00
And if that's **still** too much work for you, you can call
`interactive_template` with `fast=true` to use default values for everything
but username and plugin selection.
2017-10-01 23:25:12 +00:00
You can also use `generate_interactive` to interactively generate a template and then
immediately use it to create a new package.
2017-08-23 17:50:52 +00:00
## Comparison to PkgDev
2017-08-23 17:50:52 +00:00
`PkgTemplates` is similar in functionality to
[`PkgDev`](https://github.com/JuliaLang/PkgDev.jl)'s `generate` function. However,
`PkgTemplates` offers more customizability in templates and more extensibility via plugins.
For the package registration and release management features that `PkgTemplates` doesn't
include, you are encouraged to use [AttoBot](https://github.com/apps/attobot) instead.
## Contributing
It's extremely easy to extend `PkgTemplates` with new plugins. To get started,
check out the
2017-08-25 13:59:50 +00:00
[plugin development guide](https://invenia.github.io/PkgTemplates.jl/stable/pages/plugin_development.html).