Package Generation
Creating new packages with PkgTemplates
revolves around creating a new Template
, then calling generate
on it.
Template
PkgTemplates.Template
— Type.Template(; kwargs...) -> Template
Records common information used to generate a package. If you don't wish to manually create a template, you can use interactive_template
instead.
Keyword Arguments
user::AbstractString=""
: GitHub (or other code hosting service) username. If left unset, it will take the the global git config's value (github.user
). If that is not set, anArgumentError
is thrown. 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 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.license::AbstractString="MIT"
: Name of the package license. If an empty string is given, no license is created.available_licenses
can be used to list all available licenses, andshow_license
can be used to print out a particular license's text.authors::Union{AbstractString, Vector{<:AbstractString}}=""
: Names that appear on the license. Supply a string for one author or an array for multiple. Similarly touser
, it will take the value of of the global git config's value if it is left unset.dir::AbstractString=~/.julia/dev
: Directory in which the package will go. Relative paths are converted to absolute ones at template creation time.julia_version::VersionNumber=1.0.0
: Minimum allowed Julia version.ssh::Bool=false
: Whether or not to use SSH for the git remote. Iffalse
HTTPS will be used.dev::Bool=true
: Whether or not toPkg.develop
generated packages.manifest::Bool=false
: Whether or not to commit theManifest.toml
.plugins::Vector{<:Plugin}=Plugin[]
: A list ofPlugin
s that the package will include.
PkgTemplates.interactive_template
— Function.interactive_template(; fast::Bool=false) -> Template
Interactively create a Template
. If fast
is set, defaults will be assumed for all values except username and plugins.
generate
PkgTemplates.generate
— Function.generate(pkg::AbstractString, t::Template) -> Nothing
generate(t::Template, pkg::AbstractString) -> Nothing
Generate a package named pkg
from t
. If git
is false
, no Git repository is created.
PkgTemplates.generate_interactive
— Function.generate_interactive(pkg::AbstractString; fast::Bool=false, git::Bool=true) -> Template
Interactively create a template, and then generate a package with it. Arguments and keywords are used in the same way as in generate
and interactive_template
.
Helper Functions
PkgTemplates.gen_tests
— Function.gen_tests(pkg_dir::AbstractString, t::Template) -> Vector{String}
Create the test entrypoint in pkg_dir
.
Arguments
pkg_dir::AbstractString
: The package directory in which the files will be generatedt::Template
: The template whose tests we are generating.
Returns an array of generated file/directory names.
PkgTemplates.gen_readme
— Function.gen_readme(pkg_dir::AbstractString, t::Template) -> Vector{String}
Create a README in pkg_dir
with badges for each enabled plugin.
Arguments
pkg_dir::AbstractString
: The directory in which the files will be generated.t::Template
: The template whose README we are generating.
Returns an array of generated file/directory names.
PkgTemplates.gen_gitignore
— Function.gen_gitignore(pkg_dir::AbstractString, t::Template) -> Vector{String}
Create a .gitignore
in pkg_dir
.
Arguments
pkg_dir::AbstractString
: The directory in which the files will be generated.t::Template
: The template whose .gitignore we are generating.
Returns an array of generated file/directory names.
PkgTemplates.gen_license
— Function.gen_license(pkg_dir::AbstractString, t::Template) -> Vector{String}
Create a license in pkg_dir
.
Arguments
pkg_dir::AbstractString
: The directory in which the files will be generated.t::Template
: The template whose LICENSE we are generating.
Returns an array of generated file/directory names.