1 package Catalyst::Script::Create;
3 use MooseX::Types::Moose qw/Bool Str/;
4 use namespace::autoclean;
6 with 'Catalyst::ScriptRole';
9 traits => [qw(Getopt)],
10 cmd_aliases => 'nonew',
13 documentation => 'Force new scripts',
17 traits => [qw(Getopt)],
21 documentation => 'Force debug mode',
25 traits => [qw(Getopt)],
26 cmd_aliases => 'mech',
29 documentation => 'use WWW::Mechanize',
35 builder => '_build_helper_class',
38 sub _build_helper_class { 'Catalyst::Helper' }
43 $self->_getopt_full_usage if !$self->ARGV->[0];
45 my $helper_class = $self->helper_class;
46 Class::MOP::load_class($helper_class);
47 my $helper = $helper_class->new( { '.newfiles' => !$self->force, mech => $self->mechanize } );
49 $self->_getopt_full_usage unless $helper->mk_component( $self->application_name, @{$self->extra_argv} );
53 __PACKAGE__->meta->make_immutable;
58 Catalyst::Script::Create - Create a new Catalyst Component
62 myapp_create.pl [options] model|view|controller name [helper] [options]
65 --force don't create a .new file where a file to be created exists
66 --mechanize use Test::WWW::Mechanize::Catalyst for tests if available
67 --help display this help and exits
70 myapp_create.pl controller My::Controller
71 myapp_create.pl controller My::Controller BindLex
72 myapp_create.pl --mechanize controller My::Controller
73 myapp_create.pl view My::View
74 myapp_create.pl view MyView TT
75 myapp_create.pl view TT TT
76 myapp_create.pl model My::Model
77 myapp_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\
79 myapp_create.pl model AnotherDB DBIC::Schema MyApp::Schema create=static\
80 dbi:Pg:dbname=foo root 4321
83 perldoc Catalyst::Manual
84 perldoc Catalyst::Manual::Intro
88 Create a new Catalyst Component.
90 Existing component files are not overwritten. If any of the component files
91 to be created already exist the file will be written with a '.new' suffix.
92 This behavior can be suppressed with the C<--force> option.
96 L<Catalyst::ScriptRunner>
100 Catalyst Contributors, see Catalyst.pm
104 This library is free software, you can redistribute it and/or modify
105 it under the same terms as Perl itself.