<htmllang="en"><head><metacharset="UTF-8"/><metaname="viewport"content="width=device-width, initial-scale=1.0"/><title>Package Generation · PkgTemplates.jl</title><linkhref="https://cdnjs.cloudflare.com/ajax/libs/normalize/4.2.0/normalize.min.css"rel="stylesheet"type="text/css"/><linkhref="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono"rel="stylesheet"type="text/css"/><linkhref="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css"rel="stylesheet"type="text/css"/><linkhref="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css"rel="stylesheet"type="text/css"/><script>documenterBaseURL=".."</script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"data-main="../assets/documenter.js"></script><scriptsrc="../siteinfo.js"></script><scriptsrc="../../versions.js"></script><linkhref="../assets/documenter.css"rel="stylesheet"type="text/css"/></head><body><navclass="toc"><h1>PkgTemplates.jl</h1><selectid="version-selector"onChange="window.location.href=this.value"style="visibility: hidden"></select><formclass="search"action="../search.html"><inputid="search-query"name="q"type="text"placeholder="Search docs"/></form><ul><li><aclass="toctext"href="../index.html">Home</a></li><liclass="current"><aclass="toctext"href="package_generation.html">Package Generation</a><ulclass="internal"><li><aclass="toctext"href="#Template-1"><code>Template</code></a></li><li><aclass="toctext"href="#generate-1"><code>generate</code></a></li><li><aclass="toctext"href="#Helper-Functions-1">Helper Functions</a></li></ul></li><li><aclass="toctext"href="plugins.html">Plugins</a></li><li><aclass="toctext"href="plugin_development.html">Plugin Development</a></li><li><aclass="toctext"href="licenses.html">Licenses</a></li><li><aclass="toctext"href="index.html">Index</a></li></ul></nav><articleid="docs"><header><nav><ul><li><ahref="package_generation.html">Package Generation</a></li></ul><aclass="edit-page"href="https://github.com/invenia/PkgTemplates.jl/blob/3ec33bc02c901ed58e42ee4c367ae7ec7552ab5d/docs/src/pages/package_generation.md#L{line}"><spanclass="fa"></span> Edit on GitHub</a></nav><hr/><divid="topbar"><span>Package Generation</span><aclass="fa fa-bars"href="#"></a></div></header><h1><aclass="nav-anchor"id="Package-Generation-1"href="#Package-Generation-1">Package Generation</a></h1><p>Creating new packages with <code>PkgTemplates</code> revolves around creating a new <ahref="package_generation.html#PkgTemplates.Template"><code>Template</code></a>, then calling <ahref="package_generation.html#PkgTemplates.generate"><code>generate</code></a> on it.</p><h2><aclass="nav-anchor"id="Template-1"href="#Template-1"><code>Template</code></a></h2><sectionclass="docstring"><divclass="docstring-header"><aclass="docstring-binding"id="PkgTemplates.Template"href="#PkgTemplates.Template"><code>PkgTemplates.Template</code></a> — <spanclass="docstring-category">Type</span>.</div><div><pre><codeclass="language-none">Template(; kwargs...) -> Template</code></pre><p>Records common information used to generate a package. If you don't wish to manually create a template, you can use <ahref="package_generation.html#PkgTemplates.interactive_template"><code>interactive_template</code></a> instead.</p><p><strong>Keyword Arguments</strong></p><ul><li><p><code>user::AbstractString=""</code>: GitHub username. If left unset, it will try to take the value of a supplied git config's "github.user" key, then the global git config's value. If neither is set, an <code>ArgumentError</code> is thrown. <strong>This is case-sensitive for some plugins, so take care to enter it correctly.</strong></p></li><li><p><code>host::AbstractString="github.com"</code>: 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 inc
) -> Void</code></pre><p>Generate a package names <code>pkg_name</code> from <code>template</code>.</p><p><strong>Keyword Arguments</strong></p><ul><li><p><code>force::Bool=false</code>: Whether or not to overwrite old packages with the same name.</p></li><li><p><code>ssh::Bool=false</code>: Whether or not to use SSH for the remote.</p></li></ul><p><strong>Notes</strong></p><p>The package is generated entirely in a temporary directory and only moved into <code>joinpath(t.dir, pkg_name)</code> at the very end. In the case of an error, the temporary directory will contain leftovers, but the destination directory will remain untouched (this is especially helpful when <code>force=true</code>).</p></div><aclass="source-link"target="_blank"href="https://github.com/invenia/PkgTemplates.jl/blob/3ec33bc02c901ed58e42ee4c367ae7ec7552ab5d/src/generate.jl#LL1-L20">source</a><br/></section><h2><aclass="nav-anchor"id="Helper-Functions-1"href="#Helper-Functions-1">Helper Functions</a></h2><h4><aclass="nav-anchor"id="gen_entrypoint-1"href="#gen_entrypoint-1"><code>gen_entrypoint</code></a></h4><sectionclass="docstring"><divclass="docstring-header"><aclass="docstring-binding"id="PkgTemplates.gen_entrypoint"href="#PkgTemplates.gen_entrypoint"><code>PkgTemplates.gen_entrypoint</code></a> — <spanclass="docstring-category">Function</span>.</div><div><pre><codeclass="language-none">gen_entrypoint(
) -> Vector{String}</code></pre><p>Create the module entrypoint in the temp package directory.</p><p><strong>Arguments</strong></p><ul><li><p><code>dir::AbstractString</code>: The directory in which the files will be generated. Note that this will be joined to <code>pkg_name</code>.</p></li><li><p><code>pkg_name::AbstractString</code>: Name of the package.</p></li><li><p><code>template::Template</code>: The template whose entrypoint we are generating.</p></li></ul><p>Returns an array of generated file/directory names.</p></div><aclass="source-link"target="_blank"href="https://github.com/invenia/PkgTemplates.jl/blob/3ec33bc02c901ed58e42ee4c367ae7ec7552ab5d/src/generate.jl#LL108-L124">source</a><br/></section><h4><aclass="nav-anchor"id="gen_tests-1"href="#gen_tests-1"><code>gen_tests</code></a></h4><sectionclass="docstring"><divclass="docstring-header"><aclass="docstring-binding"id="PkgTemplates.gen_tests"href="#PkgTemplates.gen_tests"><code>PkgTemplates.gen_tests</code></a> — <spanclass="docstring-category">Function</span>.</div><div><pre><codeclass="language-none">gen_tests(
) -> Vector{String}</code></pre><p>Create the test directory and entrypoint in the temp package directory.</p><p><strong>Arguments</strong></p><ul><li><p><code>dir::AbstractString</code>: The directory in which the files will be generated. Note that this will be joined to <code>pkg_name</code>.</p></li><li><p><code>pkg_name::AbstractString</code>: Name of the package.</p></li><li><p><code>template::Template</code>: The template whose tests we are generating.</p></li></ul><p>Returns an array of generated file/directory names.</p></div><aclass="source-link"target="_blank"href="https://github.com/invenia/PkgTemplates.jl/blob/3ec33bc02c901ed58e42ee4c367ae7ec7552ab5d/src/generate.jl#LL138-L154">source</a><br/></section><h4><aclass="nav-anchor"id="gen_require-1"href="#gen_require-1"><code>gen_require</code></a></h4><sectionclass="docstring"><divclass="docstring-header"><aclass="docstring-binding"id="PkgTemplates.gen_require"href="#PkgTemplates.gen_require"><code>PkgTemplates.gen_require</code></a> — <spanclass="docstring-category">Function</span>.</div><div><pre><codeclass="language-none">gen_require(
) -> Vector{String}</code></pre><p>Create the <code>REQUIRE</code> file in the temp package directory.</p><p><strong>Arguments</strong></p><ul><li><p><code>dir::AbstractString</code>: The directory in which the files will be generated. Note that this will be joined to <code>pkg_name</code>.</p></li><li><p><code>pkg_name::AbstractString</code>: Name of the package.</p></li><li><p><code>template::Template</code>: The template whose REQUIRE we are generating.</p></li></ul><p>Returns an array of generated file/directory names.</p></div><aclass="source-link"target="_blank"href="https://github.com/invenia/PkgTemplates.jl/blob/3ec33bc02c901ed58e42ee4c367ae7ec7552ab5d/src/generate.jl#LL168-L184">source</a><br/></section><h4><aclass="nav-anchor"id="gen_readme-1"href="#gen_readme-1"><code>gen_readme</code></a></h4><sectionclass="docstring"><divclass="docstring-header"><aclass="docstring-binding"id="PkgTemplates.gen_readme"href="#PkgTemplates.gen_readme"><code>PkgTemplates.gen_readme</code></a> — <spanclass="docstring-category">Function</span>.</div><div><pre><codeclass="language-none">gen_readme(
) -> Vector{String}</code></pre><p>Create a README in the temp package directory with badges for each enabled plugin.</p><p><strong>Arguments</strong></p><ul><li><p><code>dir::AbstractString</code>: The directory in which the files will be generated. Note that this will be joined to <code>pkg_name</code>.</p></li><li><p><code>pkg_name::AbstractString</code>: Name of the package.</p></li><li><p><code>template::Template</code>: The template whose README we are generating.</p></li></ul><p>Returns an array of generated file/directory names.</p></div><aclass="source-link"target="_blank"href="https://github.com/invenia/PkgTemplates.jl/blob/3ec33bc02c901ed58e42ee4c367ae7ec7552ab5d/src/generate.jl#LL193-L209">source</a><br/></section><h4><aclass="nav-anchor"id="gen_gitignore-1"href="#gen_gitignore-1">gen_gitignore</a></h4><sectionclass="docstring"><divclass="docstring-header"><aclass="docstring-binding"id="PkgTemplates.gen_gitignore"href="#PkgTemplates.gen_gitignore"><code>PkgTemplates.gen_gitignore</code></a> — <spanclass="docstring-category">Function</span>.</div><div><pre><codeclass="language-none">gen_gitignore(
) -> Vector{String}</code></pre><p>Create a <code>.gitignore</code> in the temp package directory.</p><p><strong>Arguments</strong></p><ul><li><p><code>dir::AbstractString</code>: The directory in which the files will be generated. Note that this will be joined to <code>pkg_name</code>.</p></li><li><p><code>pkg_name::AbstractString</code>: Name of the package.</p></li><li><p><code>template::Template</code>: The template whose .gitignore we are generating.</p></li></ul><p>Returns an array of generated file/directory names.</p></div><aclass="source-link"target="_blank"href="https://github.com/invenia/PkgTemplates.jl/blob/3ec33bc02c901ed58e42ee4c367ae7ec7552ab5d/src/generate.jl#LL236-L252">source</a><br/></section><h4><aclass="nav-anchor"id="gen_license-1"href="#gen_license-1">gen_license</a></h4><sectionclass="docstring"><divclass="docstring-header"><aclass="docstring-binding"id="PkgTemplates.gen_license"href="#PkgTemplates.gen_license"><code>PkgTemplates.gen_license</code></a> — <spanclass="docstring-category">Function</span>.</div><div><pre><codeclass="language-none">gen_license(
) -> Vector{String}</code></pre><p>Create a license in the temp package directory.</p><p><strong>Arguments</strong></p><ul><li><p><code>dir::AbstractString</code>: The directory in which the files will be generated. Note that this will be joined to <code>pkg_name</code>.</p></li><li><p><code>pkg_name::AbstractString</code>: Name of the package.</p></li><li><p><code>template::Template</code>: The template whose LICENSE we are generating.</p></li></ul><p>Returns an array of generated file/directory names.</p></div><aclass="source-link"target="_blank"href="https://github.com/invenia/PkgTemplates.jl/blob/3ec33bc02c901ed58e42ee4c367ae7ec7552ab5d/src/generate.jl#LL267-L283">source</a><br/></section><footer><hr/><aclass="previous"href="../index.html"><spanclass="direction">Previous</span><spanclass="title">Home</span></a><aclass="next"href="plugins.html"><spanclass="direction">Next</span><spanclass="title">Plugins</span></a></footer></article></body></html>