/[Frey]/branches/no-pager/lib/Frey/ClassCreator.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 /branches/no-pager/lib/Frey/ClassCreator.pm

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

trunk/lib/Frey/ClassCreator.pm revision 679 by dpavlin, Tue Dec 2 02:31:58 2008 UTC branches/no-pager/lib/Frey/ClassCreator.pm revision 738 by dpavlin, Sat Dec 6 15:29:10 2008 UTC
# Line 21  has svk_add => ( Line 21  has svk_add => (
21          is => 'rw',          is => 'rw',
22          isa => 'Bool',          isa => 'Bool',
23          required => 1,          required => 1,
24          default => 0,          default => 1,
25  );  );
26    
27  sub path_size {  sub create_class_source_as_markup {
         my $path = shift;  
         $path .= ' ' . ( -s $path ) . ' bytes';  
         warn "# path_size: $path";  
         return $path;  
 }  
   
 sub create_class_source_as_data {  
28          my ($self) = @_;          my ($self) = @_;
29    
30          my $class = $self->class;          my $class = $self->class;
31    
32          my $class_path  = $class;          my $class_path  = $class;
33          $class_path =~ s{::}{/}g;          $class_path =~ s{::}{/}g;
34          $class_path = "lib/$class.pm";          $class_path = "lib/$class_path.pm";
35    
36          my $test_path = $class;          my $test_path = $class;
37          $test_path =~ s{::}{-};          $test_path =~ s{::}{-}g;
38          $test_path = "t/30-$test_path.t";          $test_path = "t/30-$test_path.t";
39    
40          die qq|class "$class" exists |, path_size($class_path) if -e $class_path;          die qq|class "$class" exists as |, $self->path_size($class_path) if -e $class_path;
41          die qq|test for "$class" exists |, path_size($class_path) if -e $class_path;          die qq|class "$class" test exists as |, $self->path_size($test_path) if -e $test_path;
42    
43          warn "## path $class_path";          warn "## path $class_path";
44          $self->mkbasepath( $class_path );          $self->mkbasepath( $class_path );
# Line 55  sub create_class_source_as_data { Line 48  sub create_class_source_as_data {
48          my $code = read_file( 'lib/Frey/Skeleton.pm' );          my $code = read_file( 'lib/Frey/Skeleton.pm' );
49          $code =~ s{$skeleton}{$class}g;          $code =~ s{$skeleton}{$class}g;
50          write_file( $class_path, $code );          write_file( $class_path, $code );
51          warn "# created class $class at ", path_size($class_path);          warn "# created class $class at ", $self->path_size($class_path);
52          system "svk add $class_path" if $self->svk_add;          system "svk add $class_path" if $self->svk_add;
53    
54          $code = read_file( 't/30-frey-skeleton.t' );          $code = read_file( 't/30-frey-skeleton.t' );
55          $code =~ s{$skeleton}{$class}g;          $code =~ s{$skeleton}{$class}g;
56          write_file( $test_path, $code );          write_file( $test_path, $code );
57          warn "# created class $class at ", path_size($test_path);          chmod 0755, $test_path;
58            warn "# created class $class at ", $self->path_size($test_path);
59          system "svk add $test_path" if $self->svk_add;          system "svk add $test_path" if $self->svk_add;
60    
61          return $code;          my $html
62                    = qq|Created class "$class" at |
63                    . $self->path_size($class_path)
64                    . qq| and test |
65                    . $self->path_size($test_path)
66                    ;
67    
68            $html = $self->html_links( $html );
69    
70            return $html;
71  }  }
72    
73  =head1 DESCRIPTION  =head1 DESCRIPTION

Legend:
Removed from v.679  
changed lines
  Added in v.738

  ViewVC Help
Powered by ViewVC 1.1.26