Create new Julia packages, the easy way
Go to file
Chris de Graaf 3c05c3f9d5 Update docs
2017-08-22 11:25:00 -05:00
defaults Tweak CI files 2017-08-18 02:05:48 -05:00
docs Update docs 2017-08-22 11:25:00 -05:00
licenses Copy over files 2017-08-11 17:18:09 -05:00
src Update docs 2017-08-22 11:25:00 -05:00
test Fix typos, change placeholder name 2017-08-18 16:08:48 -05:00
.appveyor.yml Tweak CI files 2017-08-18 02:05:48 -05:00
.codecov.yml PkgTemplates generated files 2017-08-10 12:13:01 -05:00
.gitignore Rework code, fix/add tests, fix/add docs. All the things. 2017-08-17 17:06:05 -05:00
.travis.yml Tweak CI files 2017-08-18 02:05:48 -05:00
LICENSE Fix typos, change placeholder name 2017-08-18 16:08:48 -05:00
README.md Rename interactive to interactive_template, add docs 2017-08-21 16:19:40 -05:00
REQUIRE Add interactive template generation 2017-08-21 14:54:36 -05:00

PkgTemplates

Stable Latest Build Status Build Status CodeCov

PkgTemplates is a Julia package for creating new Julia packages in an easy, repeatable, and customizable way.

Installation

PkgTemplates is registered in METADATA.jl, so run Pkg.add("PkgTemplates") for the latest release, or Pkg.clone("PkgTemplates") for the development version.

Usage

The simplest template only requires your GitHub username.

julia> using PkgTemplates

julia> t = Template(; user="christopher-dG")

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/christopher-dG/MyPkg.jl
INFO: Staged 5 files/directories: src/, test/, REQUIRE, .gitignore, README.md
INFO: Committed files generated by PkgTemplates
INFO: Moving temporary package directory into /home/degraafc/.julia/v0.6/
INFO: Finished

julia> cd(joinpath(t.dir, "MyPkg")); run(`git ls-tree -r --name-only HEAD`)
.gitignore
.travis.yml
README.md
REQUIRE
src/MyPkg.jl
test/runtests.jl

However, we can also configure a number of keyword arguments to Template and generate:

julia> t = Template(;
           user="christopher-dG",
           license="MIT",
           authors=["Chris de Graaf", "Invenia Technical Computing Corporation"],
           years="2016-2017",
           dir=joinpath(homedir(), "code"),
           julia_version=v"0.5.2",
           requirements=["PkgTemplates"],
           git_config=Dict("diff.renames" => true),
           plugins=[
               TravisCI(),
               CodeCov(; config_file=nothing),
               Coveralls(),
               AppVeyor(),
               GitHubPages(; assets=[joinpath(homedir(), "invenia.css")]),
           ],
       )

julia> generate("MyPkg", t; force=true, ssh=true)
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:christopher-dG/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: Moving temporary package directory into /home/degraafc/code/
INFO: Finished
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 documentation.

If that looks like a lot of work, you can also create templates interactively:

asciicast

Comparison to PkgDev

PkgTemplates is similar in functionality to PkgDev'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 instead.

Contributing

It's extremely easy to extend PkgTemplates with new plugins. To get started, check out the plugin development guide.