/[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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 515 - (show annotations)
Tue Nov 25 14:09:50 2008 UTC (15 years, 5 months ago) by dpavlin
File size: 1752 byte(s)
more cleanup
1 package Frey::VCI;
2
3 use Moose;
4
5 use lib '/rest/cvs/vci/lib'; # FIXME
6 use VCI;
7
8 extends 'Frey';
9 with 'Frey::Web';
10 with 'Frey::Escape';
11
12 use Data::Dump qw/dump/;
13
14 has 'repo' => (
15 is => 'rw',
16 isa => 'Str',
17 required => 1,
18 default => 'file:///home/dpavlin/private/svn/Frey',
19 );
20
21 has 'type' => (
22 is => 'rw',
23 isa => 'Str',
24 required => 1,
25 default => 'Svn',
26 );
27
28 has 'project' => (
29 is => 'rw',
30 isa => 'Str',
31 required => 1,
32 default => 'trunk',
33 );
34
35 has 'revision' => (
36 is => 'rw',
37 isa => 'Int|Str',
38 documentation => 'last revision in repository if not specified',
39 );
40
41 sub as_markup {
42 my ( $self ) = @_;
43
44 my $html;
45
46 my $repo = VCI->connect(
47 repo => $self->repo,
48 type => $self->type,
49 debug => $self->debug,
50 ) || die "can't open ",$self->type," ",$self->repo;
51
52 my @projects_available = map { $_->name } @{ $repo->projects };
53 die $self->project," not one of valid projects ", dump( @projects_available ) unless grep { $self->project } @projects_available;
54
55 my $project = $repo->get_project( name => $self->project );
56 my $rev = $self->revision || $project->head_revision;
57
58 my $commit = $project->get_commit( revision => $rev ) || die "can't get 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>' . $self->html_escape( $diff->raw ) . '</pre>' .
74 '<span class="frey-popdown">dump<code>' . $self->html_dump( $diff ) . '</code></span>';
75
76 $self->title( $self->repo . '/' . $project->name );
77 return $body;
78 };
79
80 warn "## VCI loaded";
81
82 1;

  ViewVC Help
Powered by ViewVC 1.1.26