App-SCM-Digest

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

            "Test::More" : "0"
         }
      },
      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "DateTime" : "0",
            "DateTime::Format::Strptime" : "0",
            "Email::MIME" : "0",
            "File::Path" : "0",
            "File::ReadBackwards" : "0",
            "File::Temp" : "0",
            "Getopt::Long" : "0",
            "IO::Capture::Stderr" : "0",
            "List::Util" : "0",
            "Pod::Usage" : "0",
            "Test::More" : "0",
            "YAML" : "0",

META.yml  view on Meta::CPAN

license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: App-SCM-Digest
no_index:
  directory:
    - t
    - inc
requires:
  DateTime: '0'
  DateTime::Format::Strptime: '0'
  Email::MIME: '0'
  File::Path: '0'
  File::ReadBackwards: '0'
  File::Temp: '0'
  Getopt::Long: '0'
  IO::Capture::Stderr: '0'
  List::Util: '0'
  Pod::Usage: '0'
  Test::More: '0'
  YAML: '0'

Makefile.PL  view on Meta::CPAN

    EXE_FILES     => ['bin/scm-digest'],
    MIN_PERL_VERSION => 5.006,
    CONFIGURE_REQUIRES => {
        'ExtUtils::MakeMaker' => 0,
    },
    BUILD_REQUIRES => {
        'Test::More' => 0,
    },
    PREREQ_PM => {
        'autodie'                    => 0,
        'DateTime'                   => 0,
        'DateTime::Format::Strptime' => 0,
        'Getopt::Long'               => 0,
        'Email::MIME'                => 0,
        'File::ReadBackwards'        => 0,
        'File::Path'                 => 0,
        'File::Temp'                 => 0,
        'List::Util'                 => 0,
        'Pod::Usage'                 => 0,
        'Test::More'                 => 0,
        'YAML'                       => 0,
        'IO::Capture::Stderr'        => 0,

README.md  view on Meta::CPAN

    - name: local-test
      url: file:///path/to/repository
      type: [git|hg]
      ...
```

`db_path`, `repository_path`, and `repositories` are the mandatory
configuration entries.  Paths must be absolute.

`timezone` is optional, and defaults to 'UTC'.  See
`DateTime::TimeZone::Catalog` for a list of valid timezones.

`ignore_errors` is an optional boolean, and defaults to false.  If
false, errors will cause the process to abort immediately.  If true,
errors will instead be printed to `stderr`, and the process will
continue onto the next repository.

Depending on what has happened to the remote repository, the updating
of the local repository may involve a merge.  That merge will prefer
the content from the remote repository, in the event of a conflict.

bin/scm-digest  view on Meta::CPAN

      type: [git|hg]
    - name: local-test
      url: file:///path/to/repository
      type: [git|hg]
      ...

C<db_path>, C<repository_path>, and C<repositories> are mandatory
options.

C<timezone> is optional, and defaults to 'UTC'.  See
L<DateTime::TimeZone::Catalog> for a list of valid timezones.

C<ignore_errors> is an optional boolean, and defaults to false.  If
false, errors will cause the process to abort immediately.  If true,
errors will instead be printed to C<stderr>, and the process will
continue onto the next repository.

=cut

lib/App/SCM/Digest.pm  view on Meta::CPAN

package App::SCM::Digest;

use strict;
use warnings;

use App::SCM::Digest::Utils qw(system_ad slurp);
use App::SCM::Digest::SCM::Factory;

use autodie;
use DateTime;
use DateTime::Format::Strptime;
use Getopt::Long;
use Email::MIME;
use File::Copy;
use File::Path;
use File::ReadBackwards;
use File::Temp qw(tempdir);
use List::Util qw(first);
use POSIX qw();

use constant PATTERN => '%FT%T';

lib/App/SCM/Digest.pm  view on Meta::CPAN

}

sub _process_bounds
{
    my ($self, $from, $to) = @_;

    my $config = $self->{'config'};
    my $tz = $config->{'timezone'} || 'UTC';

    if (not defined $from and not defined $to) {
        $from = DateTime->now(time_zone => $tz)
                        ->subtract(days => 1)
                        ->strftime(PATTERN);
        $to   = DateTime->now(time_zone => $tz)
                        ->strftime(PATTERN);
    } elsif (not defined $from) {
        $from = '0000-01-01T00:00:00';
    } elsif (not defined $to) {
        $to   = '9999-12-31T23:59:59';
    }

    my $strp =
        DateTime::Format::Strptime->new(pattern   => PATTERN,
                                        time_zone => $tz);

    my ($from_dt, $to_dt) =
        map { $strp->parse_datetime($_) }
            ($from, $to);
    if (not $from_dt) {
        die "Invalid 'from' time provided.";
    }
    if (not $to_dt) {
        die "Invalid 'to' time provided.";

lib/App/SCM/Digest.pm  view on Meta::CPAN

{
    my ($self, $datetime) = @_;

    my $config = $self->{'config'};
    my $tz = $config->{'timezone'};
    if ((not $tz) or ($tz eq 'UTC')) {
        return $datetime;
    }

    my $strp =
        DateTime::Format::Strptime->new(pattern   => PATTERN,
                                        time_zone => 'UTC');

    my $dt = $strp->parse_datetime($datetime);
    $dt->set_time_zone($tz);
    return $dt->strftime(PATTERN);
}

sub _load_commits
{
    my ($branch_db_path, $from, $to) = @_;

lib/App/SCM/Digest.pm  view on Meta::CPAN

        ...
    ]

The commit pull times for each of the repositories are stored in
C<db_path>, which must be a directory.

The local copies of the repositories are stored in C<repository_path>,
which must also be a directory.

The C<timezone> entry is optional, and defaults to 'UTC'.  It must be
a valid constructor value for L<DateTime::TimeZone>.  See
L<DateTime::TimeZone::Catalog> for a list of valid options.

C<ignore_errors> is an optional boolean, and defaults to false.  If
false, errors will cause methods to die immediately.  If true, errors
will instead be printed to C<stderr>, and the method will continue
onto the next repository.

L<App::SCM::Digest> clones local copies of the repositories into the
C<repository_path> directory.  These local copies should not be used
except by L<App::SCM::Digest>.



( run in 0.352 second using v1.01-cache-2.11-cpan-05444aca049 )