Fix big bug in test
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Script / Create.pm
index 6191d72..ab85ded 100644 (file)
@@ -1,11 +1,12 @@
 package Catalyst::Script::Create;
 use Moose;
-use Catalyst::Helper;
 use MooseX::Types::Moose qw/Bool/;
 use namespace::autoclean;
 
 with 'Catalyst::ScriptRole';
 
+__PACKAGE__->meta->get_attribute('help')->cmd_aliases('h');
+
 has force => (
     traits => [qw(Getopt)],
     cmd_aliases => 'nonew',
@@ -30,14 +31,18 @@ has mechanize => (
     documentation => 'use WWW::Mechanize',
 );
 
+has helper_class => ( isa => 'Str', is => 'ro', default => 'Catalyst::Helper' );
+
 sub run {
     my ($self) = @_;
 
     $self->_exit_with_usage if !$ARGV[0];
 
-    my $helper = Catalyst::Helper->new( { '.newfiles' => !$self->force, mech => $self->mech } );
+    my $helper_class = $self->helper_class;
+    Class::MOP::load_class($helper_class);
+    my $helper = $helper_class->new( { '.newfiles' => !$self->force, mech => $self->mechanize } );
 
-    $self->_display_help unless $helper->mk_component( $self->app, @ARGV );
+    $self->_exit_with_usage unless $helper->mk_component( $self->application_name, @ARGV );
 
 }