/[Frey]/trunk/lib/Frey/VCI.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Frey/VCI.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 185 by dpavlin, Tue Sep 9 23:16:26 2008 UTC revision 189 by dpavlin, Sun Sep 14 00:45:11 2008 UTC
# Line 5  use Moose; Line 5  use Moose;
5  use lib '/rest/cvs/vci/lib'; # FIXME  use lib '/rest/cvs/vci/lib'; # FIXME
6  use VCI;  use VCI;
7    
8    use HTML::Entities qw/encode_entities/;
9    
10  extends 'Frey';  extends 'Frey';
11  with 'Frey::Web';  with 'Frey::Web';
12    
# Line 12  use Data::Dump qw/dump/; Line 14  use Data::Dump qw/dump/;
14    
15  our $debug = 1;  our $debug = 1;
16    
17  sub pre {  sub pre_dump {
18          my $t = shift;          my $o = shift;
19          return "<pre>$t</pre>";          # because Data::Dumper::HTML sucks
20            my $t;
21            if ( blessed($o) && $o->can('dump') ) {
22                    $t = $o->dump;
23                    $t =~ s/ {8}/  /gm;
24            } else {
25                    $t = dump( $o );
26            }
27            return '<hr><pre>' . encode_entities($t) . '</pre><hr>';
28  }  }
29    
30  sub html {  sub html {
# Line 39  sub html { Line 49  sub html {
49          $request->print( $self->page( title => $path, body => $html ) );          $request->print( $self->page( title => $path, body => $html ) );
50          $request->next;          $request->next;
51    
52          my %param = $request->params;          %param = $request->params;
53          warn "## params = ",dump( %param );          warn "## params = ",dump( %param );
54    
55          my $project = $repo->get_project( name => $param{name} );          my $project = $repo->get_project( name => $param{name} );
56            my $rev = $project->head_revision;
57    
58            my $commit = $project->get_commit( revision => $rev );
59    
60            sub div {
61                    my ( $class, $text ) = @_;
62                    return "<div class=\"$class\">$text</div>";
63            }
64    
65            my $diff = $commit->as_diff;
66    
67            my $body =
68                    '<h1>Commit</h1>' .
69                    div( 'revision', $commit->revision ) .
70                    div( 'commiter', $commit->committer ) .
71                    div( 'date',     $commit->time->iso8601 ) .
72                    div( 'message',  $commit->message ) .
73                    '<pre>' . encode_entities( $diff->raw ) . '</pre>' .
74                    pre_dump( $diff );
75    
76          $request->print( $self->page(          $request->print( $self->page(
77                  title => $path . '/' . $project->name ,                  title => $path . '/' . $project->name,
78                  body => pre( $project->dump )                  body => $body,
79          ) );          ) );
80          $request->next;          $request->next;
81  }  }

Legend:
Removed from v.185  
changed lines
  Added in v.189

  ViewVC Help
Powered by ViewVC 1.1.26