NAME

Yukki::Model::Root - model for accessing the git repositories

VERSION

version 0.991_005

SYNOPSIS

my $root = $app->model('Root');
my $repository = $root->repository({ name => 'main' });

DESCRIPTION

This model contains method for performing actions related to the creation, deletion, and management of a set of git repositories as well as manipulating the configuration file. This model behaves as a singleton per Yukki app.

This model will be used by various administrative features of scripts and the application. For the various methods that perform modifications to work, the tool performing the actions must have write access to the configuration and the directory containing the repositories.

EXTENDS

Yukki::Model

METHODS

repository

$repository = $root->repository($key);

This will construct and return a Yukki::Model::Repository object. It's basically a synonym for:

$repository = $app->model('Repository', { name => $key });

list_repositories

@repositories = $root->list_repositories;

This will return a list of all configured repositories.

attach_repository

$root->attach_repository(%config);

Given the configuration for a repository, this will insert the configuration into the settings file. This will only insert a new configuration. It will not modify an existing one. For that you want "edit_repository".

This will create a new repository configuration file under "repo_path" in Yukki::Settings. If a configuration with the same name already exists there or if one is defined within the YUKKI_CONFIG file, this operation will fail.

The configuration to pass in is passed through to the constructor of Yukki::Settings::Repository. You will also need to pass key in, which is set to the key under which this repository will be saved.

detach_repository

$root->detach_repository(key => $key);

Given the key for a repository, this will remove the configuration. This does not work for configurations in the master file.

init_repository

$repository = $root->init_repository(
    key    => $key,
    origin => $git_uri,
    init_from_settings => $init_from_settings_flag,
);

This will initialize a new repository on disk. If origin is given, the new repository will be cloned from there. If not, a new empty repository will be committed and then a single commit inserted containing an index stub.

Before calling this method, the "attach_repository" method must be called first to configure it.

The init_from_settings flag is set to a true value (default is false), then this will allow init of repositories found in Yukki::Settings. This is intended for use by command-line tools only. Initializing YUKKI_CONFIG defined repositories from the application is not advised.

kill_repository

Deletes the git repository associated with this configuration.

AUTHOR

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Qubling Software LLC.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.