The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Copy::From::Git - A small class to pull files from remote git repos into your current space

SYNOPSIS

  use Copy::From::Git;
  
  Copy::From::Git->new(
          repo => 'zabbix',
          files => { 'agent-probes/.*?\.py$' => 'usr/bin/', },
  )->run;

METHODS

Only two methods are to be used by this class, the new and run methods. The new method accepts a number of named parameters to override the defaults provided within the constructor.

NEW

Within the constructor, the hash reference is initialized as follows:

  my $args = {
        server => 'guthub.com',
        path   => '/petermblair/',
        repo   => undef,
        branch => 'master',
        subdir => '.',
        user   => getlogin(),
        @_,
  };

The parameters of note:

server

The server from which we will pull from.

path

The path preceding the name of the repository on the server.

repo

The name of the git repository

branch

An optional branch name to pull

subdir

deprecated

user

This is inferred from the getlogin() function. As this module will likely be called within a sudo reference, we want to execute any git over ssh calls as our login username.

files

This is a HASHREF in the format of regex-location => target path. Meaning:

  files => { 'agent-probes/.*?\.py$' => 'usr/bin/', },

will look for all files that match the filename within the regex and place said file into the usr/bin location relative to your current directory.

AUTHOR

pblair@tucows.com