CVS-Metrics

 view release on metacpan or  search on metacpan

bin/cvs_wxlog  view on Meta::CPAN

  </table>
  <hr />
  <h2>Evolution Report Summary</h2>
  <table border='1' cellpadding='5'>
    <tr>
      <th width='40%'>Directories</th>
      <th width='20%'>Added files</th>
      <th width='20%'>Modified files</th>
      <th width='20%'>Deleted files</th>
    </tr>
  <!-- TMPL_LOOP NAME=summary -->
    <tr>
      <td><a href='#<TMPL_VAR NAME=dir>'><!-- TMPL_VAR NAME=dir --></a></td>
      <td><!-- TMPL_VAR NAME=added --></td>
      <td><!-- TMPL_VAR NAME=modified --></td>
      <td><!-- TMPL_VAR NAME=deleted --></td>
    </tr>
  <!-- /TMPL_LOOP -->
  </table>
  <hr />
  <h2>Detailed Evolution Report</h2>
  <table border='1' cellpadding='5'>
    <tr>
      <th width='20%'>Directories</th>
      <th width='40%'>Messages</th>
      <th width='30%'>File Descriptions</th>
      <th width='10%'>Actions</th>
    </tr>
  <!-- TMPL_LOOP NAME=dirs --><tr>
      <td valign='top' rowspan='<TMPL_VAR NAME=rowspan>'><a id='<TMPL_VAR NAME=dir>'
                 name='<TMPL_VAR NAME=dir>' /><!-- TMPL_VAR NAME=dir --></td>
    <!-- TMPL_LOOP NAME=comments -->
      <!-- TMPL_UNLESS NAME=__FIRST__ --><tr><!-- /TMPL_UNLESS -->
      <td valign='top' rowspan='<TMPL_VAR NAME=rowspan>'><!-- TMPL_VAR NAME=comment --></td>
      <!-- TMPL_LOOP NAME=files -->
        <!-- TMPL_UNLESS NAME=__FIRST__ --><tr><!-- /TMPL_UNLESS -->
        <td><span class='filename'><!-- TMPL_VAR NAME=filename --></span>
            <span class='revision'><!-- TMPL_VAR NAME=revision --></span><br />
          <!-- TMPL_LOOP NAME=tags -->
            <span class='tag'><!-- TMPL_VAR NAME=tag --></span><br />
          <!-- /TMPL_LOOP -->
            <span class='author'><!-- TMPL_VAR NAME=author --></span>
            <span class='date'><!-- TMPL_VAR NAME=date --></span></td>
        <td><!-- TMPL_VAR NAME=action --></td>
      </tr><!-- /TMPL_LOOP -->
    <!-- /TMPL_LOOP -->
  <!-- /TMPL_LOOP -->
  </table>
  <hr />
  <cite>Generated by cvs_wxlog (<!-- TMPL_VAR NAME=date -->)</cite>
  </body>
</html>
};

my $style = q{
      body  { background-color: #FFFFCC }
      table { background-color: #FFFFFF }
      th    { background-color: #DCDCDC }
      h1    { text-align: center }
      h2    { color: red }
      td a  { font-weight: bold }
      table.layout  { background-color: #FFFFCC }
      span.author   { font-weight: bold }
      span.filename { color: blue }
      span.revision { font-weight: bold; color: blue }
      span.tag      { font-weight: bold }
      span.date     { }
      span.deleted  { font-weight: bold; color: red }
      span.added    { font-weight: bold; color: blue }
      span.modified { font-weight: bold }
};

    my $template = HTML::Template->new(
            loop_context_vars   => 1,
            scalarref           => \$html,
    );
    die "can't create template ($!).\n"
            unless (defined $template);

    my $now = localtime();
    my $generator = 'cvs_wxlog ' . $CVS::Metrics::VERSION . ' (Perl ' . $] . ')';
    my $dir = $self->{path} eq '.' ? 'all' : $self->{path};
    my $title_full = "$self->{title} ${dir} $self->{tag_from} to $self->{tag_to}";

    my $image = $self->{cvs_log}->EnergyGD($self->{tags}, $self->{path}, $dir, 600, 400, $self->{tag_from}, $self->{tag_to});

    my $e_img = "e_${title_full}.png";
    $e_img =~ s/[ \/]/_/g;
    if (defined $image) {
        my $filename = ($self->{output}) ? $self->{output} . '/' . $e_img : $e_img;
        open my $OUT, '>', $filename
                or die "can't open $filename ($!).\n";
        binmode $OUT, ':raw';
        print $OUT $image->png();
        close $OUT;
    }

    my $timed_tag = $self->{cvs_log}->getTimedTag($self->{regex_ignore_tag});
    my @timed_tag = ();
    foreach my $tag (@{$self->{tags}}) {
        if ($tag eq 'HEAD') {
            push @timed_tag, {
                    tag     => $tag,
                    timed   => 'now',
            };
        }
        else {
            push @timed_tag, {
                    tag     => $tag,
                    timed   => substr($timed_tag->{$tag}, 0, 10),
            };
        }
    }

    my $date_from = substr($timed_tag->{$self->{tag_from}}, 0, 10);
    my $date_to = substr($timed_tag->{$self->{tag_to}}, 0, 10);
    $image = $self->{cvs_log}->ActivityGD($self->{path}, $dir, $self->{start_date}, 800, 225, $date_from, $date_to);

    my $a_img = "a_${title_full}.png";
    $a_img =~ s/[ \/]/_/g;
    if (defined $image) {
        my $filename = ($self->{output}) ? $self->{output} . '/' . $a_img : $a_img;
        open my $OUT, '>', $filename
                or die "can't open $filename ($!).\n";
        binmode $OUT, ':raw';
        print $OUT $image->png();
        close $OUT;
    }

    my $dir_evol = $self->{cvs_log}->getDirEvolution($self->{path}, $self->{tag_from}, $self->{tag_to}, $self->{tags});



( run in 1.354 second using v1.01-cache-2.11-cpan-364913b4093 )