NAME
Minima::Project - Backend for minima, the project manager
SYNOPSIS
use Minima::Project;
Minima::Project::create('app');
DESCRIPTION
This module is not intended to be used directly by third parties. It is the backend for minima(1). No functions are exported by default.
Templates used for generating projects reside in Minima's lib, which is stored in a package variable named $tdir
. Templates can have two extensions:
- .stpl
-
Static templates, which are copied directly.
- .dtpl
-
Dynamic templates, which are processed with Template::Toolkit and then copied.
The .[sd]
extensions are removed and the template name is converted to a proper path by get_templates
.
SUBROUTINES
create
sub create ($dir, $config)
Creates a project at $dir
with the specified configuration, passed as a hash reference in $config
. The configuration is forwarded to the templates and is optional.
If the directory is either not empty or not a directory at all, it dies.
This subroutine calls get_templates
to retrieve information about what needs to be generated and where.
get_templates
sub get_templates ($config)
Gets the available templates, processes them, and returns a hash reference containing the paths as keys and contents as values.
Templates are stored in flattened files. This subroutine converts dashes to directory slashes and plus signs to dots, allowing all template files to be stored together in a visible structure, even if they represent hidden files.
SEE ALSO
AUTHOR
Cesar Tessarin, <cesar@tessarin.com.br>.
Written in September 2024.