[Catalyst-commits] r11099 - in Catalyst-Devel/1.00/branches/moosify_api/lib/Catalyst: . Helper

dhoss at dev.catalyst.perl.org dhoss at dev.catalyst.perl.org
Mon Aug 10 08:28:44 GMT 2009


Author: dhoss
Date: 2009-08-10 08:28:43 +0000 (Mon, 10 Aug 2009)
New Revision: 11099

Modified:
   Catalyst-Devel/1.00/branches/moosify_api/lib/Catalyst/Helper.pm
   Catalyst-Devel/1.00/branches/moosify_api/lib/Catalyst/Helper/ComponentGen.pm
Log:
cleaned some things up, added moar Moose to ComponentGen


Modified: Catalyst-Devel/1.00/branches/moosify_api/lib/Catalyst/Helper/ComponentGen.pm
===================================================================
--- Catalyst-Devel/1.00/branches/moosify_api/lib/Catalyst/Helper/ComponentGen.pm	2009-08-10 08:16:54 UTC (rev 11098)
+++ Catalyst-Devel/1.00/branches/moosify_api/lib/Catalyst/Helper/ComponentGen.pm	2009-08-10 08:28:43 UTC (rev 11099)
@@ -1,8 +1,33 @@
 package Catalyst::Helper::ComponentGen;
+
 use Moose;
+use Moose::Util::TypeConstraints;
+use MooseX::Types -declare [qw/ TestDir LongComponentType ValidComponentName /];
 use namespace::autoclean;
+
 extends { 'Catalyst::Helper' };
 
+# subtypes and coercions
+# validate test dir, component name
+# make the check in $self->{test_dir} be less fucking stupid
+
+has 'test_dir' => (
+    is => 'ro',
+    isa => TestDir,
+);
+
+has 'long_comp_type' => (
+    is => 'ro',
+    isa => LongComponentType,
+    initializer => 'long_type',
+);
+
+has 'component_name' => (
+    is => 'ro',
+    isa => ValidComponentName,
+    initializer => 'comp_name',
+);
+
 # Test
 $self->{test_dir} = File::Spec->catdir( $FindBin::Bin, '..', 't' );
 $self->{test}     = $self->next_test;
@@ -18,7 +43,7 @@
             message => qq/Couldn't load helper "$class", "$@"/ );
     }
 
-    ## NO TOUCHY
+    ## NO TOUCHY ###############################################################
     if ( $class->can('mk_compclass') ) {
         return 1 unless $class->mk_compclass( $self, @args );
     }
@@ -28,6 +53,7 @@
         $class->mk_comptest( $self, @args );
     }
     else { $self->_mk_comptest }
+    ## END NO TOUCHY ###########################################################
 }
 
 sub mk_component {

Modified: Catalyst-Devel/1.00/branches/moosify_api/lib/Catalyst/Helper.pm
===================================================================
--- Catalyst-Devel/1.00/branches/moosify_api/lib/Catalyst/Helper.pm	2009-08-10 08:16:54 UTC (rev 11098)
+++ Catalyst-Devel/1.00/branches/moosify_api/lib/Catalyst/Helper.pm	2009-08-10 08:28:43 UTC (rev 11099)
@@ -129,15 +129,15 @@
     return File::Spec->catfile( $dir, "$type\_$tname" );
 }
 
-# Do not touch this method, *EVER*, it is needed for back compat.
+# Do not touch this method, *EVER*, it is needed for back compat. ##############
 ## addendum: we had to split this method so we could have backwards
 ## compatability.  otherwise, we'd have no way to pass stuff from __DATA__ 
-
 sub render_file {
     my ( $self, $file, $path, $vars ) = @_;
     my $template = $self->get_file( ( caller(0) )[0], $file );
     $self->render_file_contents($template, $path, $vars);
 }
+################################################################################
 
 sub render_sharedir_file {
     my ( $self, $file, $path, $vars ) = @_;
@@ -157,6 +157,7 @@
     $self->mk_file( $path, $output );
 }
 
+# DIE DIE DIE
 sub _mk_information {
     my $self = shift;
     print qq/Change to application directory and Run "perl Makefile.PL" to make sure your install is complete\n/;
@@ -203,18 +204,21 @@
     $self->{base} = File::Spec->rel2abs( $self->{dir} );
 }
 
+# DIE DIE DIE
 sub _mk_appclass {
     my $self = shift;
     my $mod  = $self->{mod};
     $self->render_sharedir_file( File::Spec->catfile('lib', 'MyApp.pm.tt'), "$mod.pm" );
 }
 
+# DIE DIE DIE
 sub _mk_rootclass {
     my $self = shift;
     $self->render_sharedir_file( File::Spec->catfile('lib', 'MyApp', 'Controller', 'Root.pm.tt'),
         File::Spec->catfile( $self->{c}, "Root.pm" ) );
 }
 
+# DIE DIE DIE
 sub _mk_makefile {
     my $self = shift;
     $self->{path} = File::Spec->catfile( 'lib', split( '::', $self->{name} ) );
@@ -230,6 +234,7 @@
     }
 }
 
+# DIE DIE DIE
 sub _mk_config {
     my $self      = shift;
     my $dir       = $self->{dir};
@@ -238,12 +243,14 @@
         File::Spec->catfile( $dir, "$appprefix.conf" ) );
 }
 
+# DIE DIE DIE
 sub _mk_readme {
     my $self = shift;
     my $dir  = $self->{dir};
     $self->render_sharedir_file( 'README.tt', "$dir\/README" );
 }
 
+# DIE DIE DIE
 sub _mk_changes {
     my $self = shift;
     my $dir  = $self->{dir};
@@ -299,12 +306,14 @@
     chmod 0700, "$script/$appprefix\_create.pl";
 }
 
+# DIE DIE DIE
 sub _mk_compclass {
     my $self = shift;
     my $file = $self->{file};
     return $self->render_sharedir_file( 'myapp_compclass.pl.tt', "$file" );
 }
 
+# DIE DIE DIE
 sub _mk_comptest {
     my $self = shift;
     my $test = $self->{test};
@@ -324,6 +333,7 @@
     }
 }
 
+# DIE DIE DIE
 sub _mk_favicon {
     my $self    = shift;
     my $root    = $self->{root};




More information about the Catalyst-commits mailing list