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

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

trunk/lib/Frey/ClassCreator.pm revision 711 by dpavlin, Thu Dec 4 16:02:08 2008 UTC trunk/lib/Frey/Class/Create.pm revision 1133 by dpavlin, Tue Jun 30 15:10:55 2009 UTC
# Line 1  Line 1 
1  package Frey::ClassCreator;  package Frey::Class::Create;
2  use Moose;  use Moose;
3    
4  extends 'Frey';  extends 'Frey';
5  with 'Frey::Web';  with 'Frey::Web', 'Frey::Path';
 with 'Frey::Path';  
 #with 'Frey::Storage';  
6    
7  use File::Slurp;  use File::Slurp;
8    
# Line 13  has class => ( Line 11  has class => (
11          is => 'rw',          is => 'rw',
12          isa => 'Str',          isa => 'Str',
13          required => 1,          required => 1,
14          default => 'Frey::Skeleton',          default => 'App::Skeleton',
15  );  );
16    
17  has svk_add => (  has svk_add => (
# Line 33  sub create_class_source_as_markup { Line 31  sub create_class_source_as_markup {
31          $class_path =~ s{::}{/}g;          $class_path =~ s{::}{/}g;
32          $class_path = "lib/$class_path.pm";          $class_path = "lib/$class_path.pm";
33    
34          my $test_path = $class;          my $test_path;
35          $test_path =~ s{::}{-}g;  
36          $test_path = "t/30-$test_path.t";          my @c = split(m{::}, $class);
37            foreach ( -1 .. $#c ) {
38                    my $to = $#c - $_;
39                    my $path = 't/' . join('/', @c[ 0 .. $to ] );
40                    if ( -e $path ) {
41                            my $file = join('-', @c[ $to + 1 .. $#c ] );
42                            $test_path = $path . '/' . $file . '.t';
43                            last;
44                    }
45            }
46    
47            if ( ! $test_path ) {
48                    $test_path = $class;
49                    $test_path =~ s{::}{-}g;
50                    $test_path = "t/30-$test_path.t";
51            }
52    
53          die qq|class "$class" exists as |, $self->path_size($class_path) if -e $class_path;          die qq|class "$class" exists as |, $self->path_size($class_path) if -e $class_path;
54          die qq|class "$class" test exists as |, $self->path_size($test_path) if -e $test_path;          die qq|class "$class" test exists as |, $self->path_size($test_path) if -e $test_path;
# Line 82  On the other hand, having handy class cr Line 95  On the other hand, having handy class cr
95    
96  =cut  =cut
97    
98    __PACKAGE__->meta->make_immutable;
99    no Moose;
100    
101  1;  1;

Legend:
Removed from v.711  
changed lines
  Added in v.1133

  ViewVC Help
Powered by ViewVC 1.1.26