/[Frey]/trunk/lib/Frey/SVK.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/SVK.pm

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

revision 579 by dpavlin, Fri Nov 28 01:16:21 2008 UTC revision 591 by dpavlin, Fri Nov 28 16:39:37 2008 UTC
# Line 4  use Moose; Line 4  use Moose;
4  extends 'Frey';  extends 'Frey';
5  with 'Frey::Web';  with 'Frey::Web';
6    
7    has commit_path => (
8            documentation => 'path to commit',
9            is => 'rw',
10            isa => 'Str',
11    );
12    
13    has message => (
14            documentation => 'commit message',
15            is => 'rw',
16            isa => 'Str',
17    );
18    
19  sub svk {  sub svk {
20          my ( $self, $exec, $coderef ) = @_;          my ( $self, $exec, $coderef ) = @_;
21          open(my $svk, '-|', 'svk ' . $exec) or die "svk $exec: $@";          open(my $svk, '-|', 'svk ' . $exec) or die "svk $exec: $@";
# Line 42  sub as_data { Line 54  sub as_data {
54          }          }
55  }  }
56    
57  sub as_markup {  sub status_as_markup {
58          my ($self) = @_;          my ($self) = @_;
   
         if ( ! $self->can('html_escape') ) {  
                 Frey::Web->meta->apply( $self );  
                 $self->TODO( "Frey::Web role missing" );  
         }  
   
59          my $status = `svk status -q`;          my $status = `svk status -q`;
60          $status =~ s{^(\w+\s+)(\S+)$}{$1<a href="#$2">$2</a>}gm;          $status =~ s{^(\w+\s+)(\S+)$}{$1<a href="#$2">$2</a>}gm;
61          $self->add_css( qq| pre.l a { text-decoration: none; } | );          $self->add_css( qq| pre.l a { text-decoration: none; } | );
62          $status = qq|<pre class="l">$status</pre>|;          $status = qq|<pre class="l">$status</pre>|;
63          $self->add_status( $status );          $self->add_status( $status );
64            warn "status_as_markup ",length($status)," bytes";
65            return $status;
66    }
67    
68    sub diff_as_markup {
69            my ($self) = @_;
70    
71          my $diff   = `svk diff`;          my $diff   = `svk diff`;
72    
# Line 68  sub as_markup { Line 80  sub as_markup {
80          $diff =~ s{^(===\s+)(\S+)$}{$1<a name="$2">$2</a>}gm;          $diff =~ s{^(===\s+)(\S+)$}{$1<a name="$2">$2</a>}gm;
81    
82          $diff = qq|<pre>$diff</pre>|;          $diff = qq|<pre>$diff</pre>|;
83            warn "diff_as_markup ",length($diff)," bytes";
84            return $diff;
85    }
86    
87    sub as_markup {
88            my ($self) = @_;
89    
90            if ( ! $self->can('html_escape') ) {
91                    Frey::Web->meta->apply( $self );
92                    $self->TODO( "Frey::Web role missing" );
93            }
94    
95          my $html = $status . $diff;          my $html = $self->status_as_markup . $self->diff_as_markup;
96          warn "html ",length($html)," bytes";          warn "as_markup ",length($html)," bytes";
97    
98          return $html;          return $html;
99  }  }

Legend:
Removed from v.579  
changed lines
  Added in v.591

  ViewVC Help
Powered by ViewVC 1.1.26