1 package Catalyst::Script::Create;
3 use MooseX::Types::Moose qw/Bool/;
4 use namespace::autoclean;
6 with 'Catalyst::ScriptRole';
8 __PACKAGE__->meta->get_attribute('help')->cmd_aliases('h');
11 traits => [qw(Getopt)],
12 cmd_aliases => 'nonew',
15 documentation => 'Force new scripts',
19 traits => [qw(Getopt)],
23 documentation => 'Force debug mode',
27 traits => [qw(Getopt)],
28 cmd_aliases => 'mech',
31 documentation => 'use WWW::Mechanize',
34 has helper_class => ( isa => 'Str', is => 'ro', default => 'Catalyst::Helper' );
39 $self->_exit_with_usage if !$ARGV[0];
41 my $helper_class = $self->helper_class;
42 Class::MOP::load_class($helper_class);
43 my $helper = $helper_class->new( { '.newfiles' => !$self->force, mech => $self->mechanize } );
45 $self->_exit_with_usage unless $helper->mk_component( $self->application_name, @ARGV );
49 __PACKAGE__->meta->make_immutable;
53 Catalyst::Script::Create - Create a new Catalyst Component
57 myapp_create.pl [options] model|view|controller name [helper] [options]
60 -force don't create a .new file where a file to be created exists
61 -mechanize use Test::WWW::Mechanize::Catalyst for tests if available
62 -help display this help and exits
65 myapp_create.pl controller My::Controller
66 myapp_create.pl controller My::Controller BindLex
67 myapp_create.pl -mechanize controller My::Controller
68 myapp_create.pl view My::View
69 myapp_create.pl view MyView TT
70 myapp_create.pl view TT TT
71 myapp_create.pl model My::Model
72 myapp_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\
74 myapp_create.pl model AnotherDB DBIC::Schema MyApp::Schema create=static\
75 dbi:Pg:dbname=foo root 4321
78 perldoc Catalyst::Manual
79 perldoc Catalyst::Manual::Intro
83 Create a new Catalyst Component.
85 Existing component files are not overwritten. If any of the component files
86 to be created already exist the file will be written with a '.new' suffix.
87 This behavior can be suppressed with the C<-force> option.
91 Catalyst Contributors, see Catalyst.pm
95 This library is free software, you can redistribute it and/or modify
96 it under the same terms as Perl itself.