PkgTemplates.jl/docs/src/index.md

88 lines
2.9 KiB
Markdown
Raw Normal View History

2017-08-10 17:13:01 +00:00
# PkgTemplates
2017-08-16 22:10:13 +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-12-05 20:07:30 +00:00
[![Build Status](https://ci.appveyor.com/api/projects/status/r24xamruqlm88uti/branch/master?svg=true)](https://ci.appveyor.com/project/christopher-dG/pkgtemplates-jl/branch/master)
2018-11-05 22:05:30 +00:00
[![Codecov](https://codecov.io/gh/invenia/PkgTemplates.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/invenia/PkgTemplates.jl)
2017-08-16 22:10:13 +00:00
**PkgTemplates is a Julia package for creating new Julia packages in an easy,
repeatable, and customizable way.**
## Installation
2018-09-26 20:55:24 +00:00
```julia
pkg> add PkgTemplates
2018-09-26 20:55:24 +00:00
```
2017-08-16 22:10:13 +00:00
## Usage
```@setup usage
run(`git config --global user.name "Travis"`)
run(`git config --global user.email "travis@c.i"`)
run(`git config --global github.user "travis"`)
using Pkg
Pkg.activate(mktempdir())
Pkg.add(PackageSpec(path=dirname(dirname(pwd()))))
```
2018-09-26 20:55:24 +00:00
The simplest template requires no arguments.
2017-08-16 22:10:13 +00:00
```@repl usage
2017-08-18 07:08:11 +00:00
using PkgTemplates
2018-09-26 20:55:24 +00:00
t = Template()
2017-08-18 07:08:11 +00:00
generate("MyPkg", t)
2018-09-26 20:55:24 +00:00
run(`git -C $(joinpath(t.dir, "MyPkg")) ls-files`);
2017-08-16 22:10:13 +00:00
```
2017-08-18 07:08:11 +00:00
2017-08-22 20:13:25 +00:00
However, we can also configure a number of keyword arguments to
2018-09-26 20:55:24 +00:00
[`Template`](@ref):
2017-08-16 22:10:13 +00:00
```@repl usage
2017-08-18 07:08:11 +00:00
using PkgTemplates
t = Template(;
user="myusername",
2017-08-18 07:08:11 +00:00
license="MIT",
authors=["Chris de Graaf", "Invenia Technical Computing Corporation"],
dir="~/code",
julia_version=v"0.7",
2018-09-26 20:55:24 +00:00
ssh=true,
2017-08-18 07:08:11 +00:00
plugins=[
TravisCI(),
2018-11-05 22:05:30 +00:00
Codecov(),
2017-08-18 07:08:11 +00:00
Coveralls(),
AppVeyor(),
2017-08-24 20:14:27 +00:00
GitHubPages(),
2017-08-18 07:08:11 +00:00
],
2018-09-26 20:55:24 +00:00
)
generate("MyPkg2", t)
run(`git -C $(joinpath(t.dir, "MyPkg2")) ls-files`);
2017-08-16 22:10:13 +00:00
```
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`](@ref):
2018-10-10 19:56:03 +00:00
[![asciicast](https://asciinema.org/a/31bZqW9u8h5RHpd7gtsemioRV.png)](https://asciinema.org/a/31bZqW9u8h5RHpd7gtsemioRV)
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`](@ref) to interactively generate a template and then
immediately use it to create a new package.
2018-09-26 20:55:24 +00:00
## Comparison to PkgDev
`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
2017-08-16 22:10:13 +00:00
2018-09-26 20:55:24 +00:00
It's extremely easy to extend `PkgTemplates` with new plugins. To get started,
check out the
[plugin development guide](https://invenia.github.io/PkgTemplates.jl/stable/pages/plugin_development.html).