NAME

Git::PunchCard - Gathers info for making punchcard style graphs for git.

VERSION

Version 0.1.0

SYNOPSIS

Quick summary of what the module does.

Perhaps a little code snippet.

use Git::PunchCard;
use Data::Dumper;
use Text::Table;

my $gpc = Git::PunchCard->new();

$gpc->dir($some_git_repo_dir);
if ( $gpc->error ){
    print "Could not process the directory.\n";
}

my $card=$gpc->get_card;

print Dumper( $card );

# The various keys for the hashes.
my @days=('Sun','Mon','Tue','Wed','Thu','Fri','Sat', );
my @hours=('00','01','02','03','04','05','06','07','08','09','10', '11','12','13','14','15','16','17','18','19','20','21','22','23');

# Stores the lines to for the table.
my @data;

# Process each day hash in $card.
foreach my $day ( @days ){
    my @line;

    # Add the day coloumn to the current line of the table.
    push( @line, $day );

    # Add each hour entry to the current line of the table.
    foreach my $hour ( @hours ){
        push( @line, $card->{$day}{$hour} );
    }

    # Finally add the total number of entries for that day.
    push( @line, $card->{$day}{total}.color('WHITE') );

    # add the new line to the table data
    push( @data, \@line );
}

# Init the Text::Table object and add our headers.
my $table=Text::Table->new('','00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','Total');

# Loads the data into the table
$table->load( @data );

# produce some useful? output
print $table."\nTotal: ".$card->{total}."\n";

METHODS

new

Inits the object.

my $gpc->new;

card

One argument is taken and that is the directory to parse in.

If one is not passed, the current directory will be used.

IF this is called multiple times, each new instance will be added to the current values.

$gpc->dir( $dir )
if ( $gpc->error ){
    print "Errored!\n";
}

This returns the current card data.

The returned value is a hashref.

The first level keys are the three letter day names the the second level keys are the two digit hour.

There are two special keys 'total', 'max', min, and avagerage.

'total' represents the total level of commits. So at the primary level it is all the commits made to that repo while and the secondary level it is all the comits made to that repo on that day of the week.

'max' is the largest number of commits made. At the primary level it is any hour on any day of the week while at the secondary level it is the max made during any given hour that day.

'min' and 'average' is similar as max, but representing the min and average instead.

For examples of making use of this, see the SYNOPSIS or check out the script punchard-git.

my $card=$gpc->get_card;

ERROR NUMBERS/FLAGS

Error handling is provided by Error::Helper.

1 / gitError

Git exited with a non-zero value.

AUTHOR

Zane C. Bowers-Hadley, <vvelox at vvelox.net>

BUGS

Please report any bugs or feature requests to bug-git-punchcard at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Git-PunchCard. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Git::PunchCard

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2019 by Zane C. Bowers-Hadley.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

1 POD Error

The following errors were encountered while parsing the POD:

Around line 401:

Unknown directive: =head