Package Generation

Package Generation

Creating new packages with PkgTemplates revolves around creating a new Template, then calling generate on it.

Template

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, an ArgumentError 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, and show_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 to user, 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.1: Minimum allowed Julia version.
  • ssh::Bool=false: Whether or not to use SSH for the remote.
  • plugins::Vector{<:Plugin}=Plugin[]: A list of Plugins that the package will include.
source
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.

source

generate

PkgTemplates.generateFunction.
generate(pkg::AbstractString, t::Template) -> Nothing
generate(t::Template, pkg::AbstractString) -> Nothing

Generate a package named pkg from t.

source
generate_interactive(pkg::AbstractString; fast::Bool=false) -> 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.

source

Helper Functions

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 generated
  • t::Template: The template whose tests we are generating.

Returns an array of generated file/directory names.

source
gen_require(pkg_dir::AbstractString, t::Template) -> Vector{String}

Create the REQUIRE file in pkg_dir.

Arguments

  • pkg_dir::AbstractString: The directory in which the files will be generated.
  • t::Template: The template whose REQUIRE we are generating.

Returns an array of generated file/directory names.

source
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.

source
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.

source
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.

source