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.generate
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(src_path, dst_path[, data]; true, 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. 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.
The other keyword arguments are passed directly to the internal Copier.copy
.
BestieTemplate.generate
— Functiongenerate(dst_path[, data]; kwargs...)
generate(src_path, dst_path[, data]; true, 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. 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
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.
The other keyword arguments are passed directly to the internal Copier.copy
.
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
: NamedTuple of Dictionaries with default dataDebug.Data.required
: Required data if you usedefaults = true
Debug.Data.strategy_minimum
: Required data for strategy minimum, no defaults.Debug.Data.strategy_recommended
: Required data for strategy recommended, no defaults.Debug.Data.strategy_ask
: Required data for strategy ask, no defaults.