Reference
Contents
Index
BestieTemplate.BestieTemplate
BestieTemplate.Copier
BestieTemplate.Debug
BestieTemplate.Debug.Data
BestieTemplate.Copier.copy
BestieTemplate.Copier.recopy
BestieTemplate.Copier.update
BestieTemplate.Debug.dbg_apply
BestieTemplate.Debug.dbg_data
BestieTemplate.Debug.dbg_generate
BestieTemplate._copy
BestieTemplate._read_data_from_existing_path
BestieTemplate._sanitize_package_name
BestieTemplate.apply
BestieTemplate.change_project_permissions
BestieTemplate.generate
BestieTemplate.new_pkg_quick
BestieTemplate.update
Auto docs
BestieTemplate.BestieTemplate
— ModuleBestieTemplate.jl
This package defines a copier template for Julia packages and a basic user interface around copier to use it from Julia.
The main functions are: generate
, apply
, and update
.
To create a new package using BestieTemplate run
julia> BestieTemplate.generate("path/to/YourNewPackage.jl")
To apply the template to an existing package
julia> BestieTemplate.apply("path/to/YourExistingPackage.jl")
Check the documentation: https://JuliaBesties.github.io/BestieTemplate.jl
BestieTemplate._copy
— Method_copy(src_path, dst_path, data; kwargs...)
Internal function to run common code for new or existing packages.
BestieTemplate._read_data_from_existing_path
— Methoddata = _read_data_from_existing_path(dst_path)
Reads the destination folder to figure out some answers.
BestieTemplate._sanitize_package_name
— Methodpackage_name = _sanitize_package_name(path)
Sanitize the path
to guess the package_name by looking at the base name and removing an extension. If the result is not a valid identifier, returns "".
BestieTemplate.apply
— Functionapply(dst_path[, data]; kwargs...)
apply(local_or_online, dst_path[, data]; kwargs...)
apply(src_path, dst_path[, data]; kwargs...)
Applies the template to an existing project at path $dst_path$. If the dst_path
does not exist, this will throw an error. For new packages, use BestieTemplate.generate
instead.
Runs the copy
command of copier with the BestieTemplate template, with overwrite = true
. If src_path
is not informed, the GitHub URL of BestieTemplate.jl is used.
The data
argument is a dictionary of answers (values) to questions (keys) that can be used to bypass some of the interactive questions.
Keyword arguments
guess:Bool = true
: Whether to try to guess some of the data from the package itself.warn_existing_pkg::Bool = true
: Whether to check if you actually meantupdate
. If you runapply
and thedst_path
contains a.copier-answers.yml
, it means that the copy was already made, so you might have meansupdate
instead. Whentrue
, a warning is shown and execution is stopped.quiet::Bool = false
: Whether to print greetings, info, and other messages. This keyword is also used by copier.change_permissions::Boolean = false
: Whether to change the permissions of the destination project.
The other keyword arguments are passed directly to the internal Copier.copy
.
BestieTemplate.change_project_permissions
— Methodchange_project_permissions(project_path)
Change the permission of all files in the project_path
to 644 and folders to 755.
BestieTemplate.generate
— Functiongenerate(dst_path[, data]; kwargs...)
generate(local_or_online, dst_path[, data]; kwargs...)
generate(src_path, dst_path[, data]; kwargs...)
Generates a new project at the path dst_path
using the template. If the dst_path
already exists, this will throw an error, unless dst_path = "."
. For existing packages, use BestieTemplate.apply
instead.
Runs the copy
command of copier with the BestieTemplate template.
local_or_online
can be either :local
or :online
. If it is :online
, the GitHub URL of BestieTemplate.jl is used. Otherwise, the pkgdir(BestieTemplate)
is used.
If src_path
is informed an URL or a path to a compatible template is expected.
The data
argument is a dictionary of answers (values) to questions (keys) that can be used to bypass some of the interactive questions. See https://juliabesties.github.io/BestieTemplate.jl/stable/30-questions/ for a list all questions.
Keyword arguments
warn_existing_pkg::Boolean = true
: Whether to check if you actually meantupdate
. If you rungenerate
and thedst_path
contains a.copier-answers.yml
, it means that the copy was already made, so you might have meansupdate
instead. Whentrue
, a warning is shown and execution is stopped.quiet::Boolean = false
: Whether to print greetings, info, and other messages. This keyword is also used by copier.change_permissions::Boolean = false
: Whether to change the permissions of the generated project.
The other keyword arguments are passed directly to the internal Copier.copy
.
BestieTemplate.new_pkg_quick
— Functionnew_pkg_quick(
pkg_destination,
package_owner,
authors,
strategy::Symbol,
extra_data = Dict();
license = "MIT",
template_source = :local,
use_latest = false,
kwargs...;
)
Creates a new package using defaults and no interaction.
Convenience function that requires the least amount of information to generate a package using the "Tiny" strategy.
Arguments
pkg_destination
: Path to the folder where the package will be created. Examples:"NewPkg.jl"
,"."
,"~/.julia/dev/NewPkg.jl"
package_owner
: GitHub username or organization that owns the package (This will be used for URLs). Examples:"JuliaBesties"
,"username"
authors
: Package authors separated by commas (We recommend the form "NAME <EMAIL>", but this can be ignored). Examples:"JuliaBesties maintainers"
,"Alice <alice@alice.com>, Bob <bob@bob.nl>"
strategy::Symbol
: Which strategy to use. Values::tiny
,:light
,:moderate
, and:robust
extra_data
: Dictionary with extra data to be added to the answers file. Default:Dict()
. Examples:Dict("AddDocs" => true)
. See the Questions section for all the options.
Keyword arguments
license
: Which license to add. Default:MIT
. Choices:"Apache-2.0"
,"GPL-3.0"
,"MIT"
,"MPL-2.0"
,"nothing"
.template_source::Symbol
: Source of the template, either:local
or:online
.:local
uses the path of the BestieTemplate package, and:online
uses the GitHub URL. Default::local
.use_latest::Bool
: Whether to use the latest commit of the template (otherwise use the last release). Default:false
.- Additional keyword arguments are passed directly to
generate
.
BestieTemplate.update
— Functionupdate([data]; kwargs...)
update(dst_path[, data]; kwargs...)
Run the update command of copier, updating the dst_path
(or the current path if omitted) with a new version of the template with a new version of the template.
The data
argument is a dictionary of answers (values) to questions (keys) that can be used to bypass some of the interactive questions.
Keyword arguments
The keyword arguments are passed directly to the internal Copier.update
.
BestieTemplate.Copier
— ModuleBestieTemplate.Copier.copy
— Functioncopy(dst_path[, data]; kwargs...)
copy(src_path, dst_path[, data]; kwargs...)
Wrapper around copier.run_copy.
This is an internal function, if BestieTemplate's main API is not sufficient, open an issue. Note: this is not Base.copy
, inside the Copier module we shadow that name.
BestieTemplate.Copier.recopy
— Functionrecopy(dst_path[, data]; kwargs...)
Wrapper around copier.run_recopy.
This is an internal function, if BestieTemplate's main API is not sufficient, open an issue.
BestieTemplate.Copier.update
— Functionupdate(dst_path[, data]; kwargs...)
Wrapper around copier.run_update.
This is an internal function, if BestieTemplate's main API is not sufficient, open an issue.
Debug auto docs
BestieTemplate.Debug
— ModuleModule Debug
Tools for debugging Bestie. Nothing here is public API.
This file is not tested and not covered in codecov. Except for the data, it is not supposed to be used in the tests.
Noteworthy: BestieTemplate.Debug.Data
BestieTemplate.Debug.dbg_apply
— Functiondbg_apply([dst_path, data]; data_choice=:minimum)
Convenience function to help debug apply
. It runs apply
with the dst_path
destination and the given data
(nothing by default).
It also uses a data_choice
to determine fake starting data. This is passed to dbg_data
.
It uses the pkgdir
location of Bestie and adds the flags
defaults = true
: Sent to copier to use the default answers.quiet = true
: Low verbosity.overwrite = true
: Overwrite all files.vcs_ref = HEAD
: Use the development version of the template, including dirty repo changes.
BestieTemplate.Debug.dbg_data
— Functiondbg_data(data_choice, more_data)
Returns the fake debug data merged with more_data
. The options for data_choice
are:
:nothing
,:none
: No random data.:required
,:req
: Only the required data is generated. You get asked which choice of optional data.:minimum
,:min
: The required data plus the choice "minimum" for optional data.:recommended
,:rec
: The required data plus the choice "recommended" for optional data.:ask
: The required data plus the choice "ask". The optional questions will be asked.:ask_default
: Same as:ask
plus the default answers for the optional questions.:ask_and_say_no
: Same as:ask
plus answers no/false to the optional questions.:ask_and_say_yes
: Same as:ask
plus answers yes/true to the optional questions.
BestieTemplate.Debug.dbg_generate
— Functiondbg_generate([dst_path, data]; data_choice=:minimum)
Convenience function to help debug generate
.
It runs generate
with the dst_path
destination (random by default) and the given data
(nothing by default).
It also uses a data_choice
to determine fake starting data. This is passed to dbg_data
.
This function can be called in multiple ways:
dbg_generate()
: Use all defaultsdbg_generate(my_data::Dict)
: Usemy_data
and all defaultsdbg_generate(dst_path::String)
: Usedst_path
and all defaultsdbg_generate(data_choice::Symbol)
: Use all defaults anddata_choice
to generatemy_data
It uses the pkgdir
location of Bestie and adds the flags
defaults = true
: Sent to copier to use the default answers.quiet = true
: Low verbosity.vcs_ref = HEAD
: Use the development version of the template, including dirty repo changes.
BestieTemplate.Debug.Data
— ModuleFake data for testing
Debug.Data.strategies
: NamedTuple of Dictionaries with default data