Alambic Perldoc

Description Alambic
Alambic Perldoc > Perl Modules > Alambic::Tools::Git
Source

NAME

Alambic::Tools::Git - A plugin to manage a git repository.

DESCRIPTION

Alambic::Tools::Git provides an interface to the Git software configuration management tool within Alambic. It specifically provides methods to clone and pull a repository, and to get the log of commits.

For the complete configuration see the user documentation on the web site: https://alambic.io/Plugins/Tools/Git.html.

new()

    my $tool = Alambic::Tools::Git->new(
    'test.project', 
    'https://BorisBaldassari@bitbucket.org/BorisBaldassari/alambic.git');
    my $version = $tool->version();

Build a new Git object.

If the git directory exists, the plugin will use it. Otherwise a clone will be automatically executed at object startup.

get_conf()

    my $conf = $tool->get_conf();

Get configuration for this Git plugin instance. Returns a hash reference.

    (
      "id" => "git",
      "name" => "Git Tool",
      "desc" => "Provides Git commands and features.",
      "ability" => [
        "methods", "project"
      ],
      "type" => "tool",
      "params" => {"path_git" => "The absolute path to the git binary.",},
      "provides_methods" => {
        "git_clone" => "Clone a project git repository locally.",
        "git_pull" => "Execute a pull from a git repository.",
        "git_clone_or_pull" => "Execute a pull from a git repository, 
          clone if it doesn't exist.",
        "git_log" => "Retrieves log from a local git repository.",
        "git_commits" => "Retrieves commits for a git repository.",
      },
    )

version()

    my $version = $tool->version();

Returns Git version as a string.

test()

    my $log = $tool->test();

Self-test method for the tool. Returns a log as an array reference.

    [
      'OK: Git exec found in PATH at [/usr/bin/git].'
    ]

git_clone_or_pull()

    $log = $tool->git_clone_or_pull();

Function to get a git repository locally, not even knowing if it's already there or not. If it exists, it will be pulld. If it doesn't, it will be cloned

git_clone()

    $log = $tool->git_clone('test.project',
      'https://BorisBaldassari@bitbucket.org/BorisBaldassari/alambic.git');

Function to clone a git repository locally. It assumes the repository doesn't already exists (fails otherwise).

git_log()

    $git->git-log('modeling.sirius');

Function to get the log from a git repository. It assumes the repository already exists (fails otherwise).

Log file is written in the input directory of the project data space.

git_commits()

    my $commits = $git->git_commits();

Returns an array of commits

git_pull()

    $git->git_pull();

Function to pull from a git repository. It is assumed that the clone directory already exists.

SEE ALSO

https://alambic.io/Plugins/Tools/Git.html, https://stackoverflow.com,

Mojolicious, http://alambic.io, https://bitbucket.org/BorisBaldassari/alambic