39 lines
16 KiB
HTML
39 lines
16 KiB
HTML
![]() |
<!DOCTYPE html>
|
||
|
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Package Generation · PkgTemplates.jl</title><link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/4.2.0/normalize.min.css" rel="stylesheet" type="text/css"/><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js" data-main="../assets/documenter.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/></head><body><nav class="toc"><h1>PkgTemplates.jl</h1><select id="version-selector" onChange="window.location.href=this.value" style="visibility: hidden"></select><form class="search" id="search-form" action="../search.html"><input id="search-query" name="q" type="text" placeholder="Search docs"/></form><ul><li><a class="toctext" href="../index.html">Home</a></li><li class="current"><a class="toctext" href="package_generation.html">Package Generation</a><ul class="internal"><li><a class="toctext" href="#Template-1"><code>Template</code></a></li><li><a class="toctext" href="#generate-1"><code>generate</code></a></li></ul></li><li><a class="toctext" href="plugins.html">Plugins</a></li><li><a class="toctext" href="plugin_development.html">Plugin Development</a></li><li><a class="toctext" href="licenses.html">Licenses</a></li><li><a class="toctext" href="index.html">Index</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href="package_generation.html">Package Generation</a></li></ul><a class="edit-page" href="https://github.com/invenia/PkgTemplates.jl/blob/master/docs/src/pages/package_generation.md#L{line}"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>Package Generation</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="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 <a href="package_generation.html#PkgTemplates.Template"><code>Template</code></a>, then calling <a href="package_generation.html#PkgTemplates.generate"><code>generate</code></a> on it.</p><h2><a class="nav-anchor" id="Template-1" href="#Template-1"><code>Template</code></a></h2><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="PkgTemplates.Template" href="#PkgTemplates.Template"><code>PkgTemplates.Template</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="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 <a href="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 incorrect output. For example, <a href="plugins.html#PkgTemplates.AppVeyor"><code>AppVeyor</cod
|
||
|
pkg_name::AbstractString,
|
||
|
t::Template;
|
||
|
force::Bool=false,
|
||
|
ssh::Bool=false,
|
||
|
backup_dir::AbstractString="",
|
||
|
) -> Void</code></pre><p>Generate a package named <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><li><p><code>backup_dir::AbstractString=""</code>: Directory in which to store the generated package if <code>t.dir</code> is not a valid directory. If left unset, a temporary directory will be created (this keyword is mostly for internal usage).</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><a class="source-link" target="_blank" href="https://github.com/invenia/PkgTemplates.jl/blob/7e38c924132f70b12eceb2dc01dabafdc3a1fea5/src/generate.jl#LL1-L24">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="PkgTemplates.generate_interactive" href="#PkgTemplates.generate_interactive"><code>PkgTemplates.generate_interactive</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">generate_interactive(
|
||
|
pkg_name::AbstractString;
|
||
|
force::Bool=false,
|
||
|
ssh::Bool=false,
|
||
|
backup_dir::AbstractString="",
|
||
|
fast::Bool=false,
|
||
|
) -> Void</code></pre><p>Interactively create a template, and then generate a package with it. Arguments and keywords are used in the same way as in <a href="package_generation.html#PkgTemplates.generate"><code>generate</code></a> and <a href="package_generation.html#PkgTemplates.interactive_template"><code>interactive_template</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/invenia/PkgTemplates.jl/blob/7e38c924132f70b12eceb2dc01dabafdc3a1fea5/src/generate.jl#LL131-L143">source</a></section><h3><a class="nav-anchor" id="Helper-Functions-1" href="#Helper-Functions-1">Helper Functions</a></h3><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="PkgTemplates.gen_entrypoint" href="#PkgTemplates.gen_entrypoint"><code>PkgTemplates.gen_entrypoint</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">gen_entrypoint(
|
||
|
dir::AbstractString,
|
||
|
pkg_name::AbstractString,
|
||
|
template::Template,
|
||
|
) -> 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><a class="source-link" target="_blank" href="https://github.com/invenia/PkgTemplates.jl/blob/7e38c924132f70b12eceb2dc01dabafdc3a1fea5/src/generate.jl#LL160-L176">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="PkgTemplates.gen_tests" href="#PkgTemplates.gen_tests"><code>PkgTemplates.gen_tests</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">gen_tests(
|
||
|
dir::AbstractString,
|
||
|
pkg_name::AbstractString,
|
||
|
template::Template,
|
||
|
) -> 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><a class="source-link" target="_blank" href="https://github.com/invenia/PkgTemplates.jl/blob/7e38c924132f70b12eceb2dc01dabafdc3a1fea5/src/generate.jl#LL191-L207">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="PkgTemplates.gen_require" href="#PkgTemplates.gen_require"><code>PkgTemplates.gen_require</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">gen_require(
|
||
|
dir::AbstractString,
|
||
|
pkg_name::AbstractString,
|
||
|
template::Template,
|
||
|
) -> 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><a class="source-link" target="_blank" href="https://github.com/invenia/PkgTemplates.jl/blob/7e38c924132f70b12eceb2dc01dabafdc3a1fea5/src/generate.jl#LL223-L239">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="PkgTemplates.gen_readme" href="#PkgTemplates.gen_readme"><code>PkgTemplates.gen_readme</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">gen_readme(
|
||
|
dir::AbstractString,
|
||
|
pkg_name::AbstractString,
|
||
|
template::Template,
|
||
|
) -> 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><a class="source-link" target="_blank" href="https://github.com/invenia/PkgTemplates.jl/blob/7e38c924132f70b12eceb2dc01dabafdc3a1fea5/src/generate.jl#LL248-L264">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="PkgTemplates.gen_gitignore" href="#PkgTemplates.gen_gitignore"><code>PkgTemplates.gen_gitignore</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">gen_gitignore(
|
||
|
dir::AbstractString,
|
||
|
pkg_name::AbstractString,
|
||
|
template::Template,
|
||
|
) -> 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><a class="source-link" target="_blank" href="https://github.com/invenia/PkgTemplates.jl/blob/7e38c924132f70b12eceb2dc01dabafdc3a1fea5/src/generate.jl#LL291-L307">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="PkgTemplates.gen_license" href="#PkgTemplates.gen_license"><code>PkgTemplates.gen_license</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">gen_license(
|
||
|
dir::AbstractString,
|
||
|
pkg_name::AbstractString,
|
||
|
template::Template,
|
||
|
) -> 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><a class="source-link" target="_blank" href="https://github.com/invenia/PkgTemplates.jl/blob/7e38c924132f70b12eceb2dc01dabafdc3a1fea5/src/generate.jl#LL322-L338">source</a></section><footer><hr/><a class="previous" href="../index.html"><span class="direction">Previous</span><span class="title">Home</span></a><a class="next" href="plugins.html"><span class="direction">Next</span><span class="title">Plugins</span></a></footer></article></body></html>
|