Updated catalyst.pl
[catagits/Catalyst-Runtime.git] / script / catalyst.pl
CommitLineData
fc7ec1d9 1#!/usr/bin/perl -w
2
3use strict;
4use Getopt::Long;
5use Pod::Usage;
6use Catalyst::Helper;
7
640faa87 8my $force = 0;
e4d88362 9my $help = 0;
e4d88362 10my $scripts = 0;
11my $short = 0;
fc7ec1d9 12
1c773d18 13GetOptions(
640faa87 14 'help|?' => \$help,
15 'force|nonew' => \$force,
16 'scripts' => \$scripts,
17 'short' => \$short
1c773d18 18);
fc7ec1d9 19
20pod2usage(1) if ( $help || !$ARGV[0] );
21
8264c145 22my $helper =
e4d88362 23 Catalyst::Helper->new(
640faa87 24 { '.newfiles' => !$force, 'scripts' => $scripts, 'short' => $short } );
fc7ec1d9 25pod2usage(1) unless $helper->mk_app( $ARGV[0] );
26
271;
28__END__
29
30=head1 NAME
31
32catalyst - Bootstrap a Catalyst application
33
34=head1 SYNOPSIS
35
d459eb44 36catalyst.pl [options] application-name
fc7ec1d9 37
38 Options:
640faa87 39 -force don't create a .new file where a file to be created exists
e4d88362 40 -help display this help and exits
e4d88362 41 -scripts update helper scripts only
42 -short use short types, like C instead of Controller...
fc7ec1d9 43
4be535b1 44 application-name must be a valid Perl module name and can include "::"
fc7ec1d9 45
46 Examples:
d459eb44 47 catalyst.pl My::App
48 catalyst.pl MyApp
fc7ec1d9 49
ae1e6b59 50 To upgrade your app to a new version of Catalyst:
640faa87 51 catalyst.pl -force -scripts MyApp
ae1e6b59 52
03a53815 53
fc7ec1d9 54=head1 DESCRIPTION
55
4be535b1 56The C<catalyst.pl> script bootstraps a Catalyst application, creating a
57directory structure populated with skeleton files.
58
59The application name must be a valid Perl module name. The name of the
60directory created is formed from the application name supplied, with double
61colons replaced with hyphens (so, for example, the directory for C<My::App> is
62C<My-App>).
63
64Using the example application name C<My::App>, the application directory will
65contain the following items:
66
67=over 4
68
69=item README
70
71a skeleton README file, which you are encouraged to expand on
72
73=item Build.PL
74
75a C<Module::Build> build script
76
77=item Changes
78
79a changes file with an initial entry for the creation of the application
80
81=item Makefile.PL
82
83an old-style MakeMaker script. Catalyst uses the C<Module::Build> system so
84this script actually generates a Makeifle that invokes the Build script.
85
86=item lib
87
88contains the application module (C<My/App.pm>) and
89subdirectories for model, view, and controller components (C<My/App/M>,
90C<My/App/V>, and C<My/App/C>).
91
92=item root
93
94root directory for your web document content. This is left empty.
95
96=item script
97
98a directory containing helper scripts:
99
100=over 4
101
102=item C<my_app_create.pl>
103
104helper script to generate new component modules
105
106=item C<my_app_server.pl>
107
108runs the generated application within a Catalyst test server, which can be
109used for testing without resorting to a full-blown web server configuration.
110
111=item C<my_app_cgi.pl>
112
113runs the generated application as a CGI script
114
115=item C<my_app_fastcgi.pl>
116
117runs the generated application as a FastCGI script
118
119
120=item C<my_app_test.pl>
121
122runs an action of the generated application from the comand line.
123
124=back
125
126=item t
127
128test directory
129
130=back
131
132
133The application module generated by the C<catalyst.pl> script is functional,
1c773d18 134although it reacts to all requests by outputting a friendly welcome screen.
4be535b1 135
136
137=head1 NOTE
138
139Neither C<catalyst.pl> nor the generated helper script will overwrite existing
140files. In fact the scripts will generate new versions of any existing files,
141adding the extension C<.new> to the filename. The C<.new> file is not created
142if would be identical to the existing file.
143
144This means you can re-run the scripts for example to see if newer versions of
145Catalyst or its plugins generate different code, or to see how you may have
146changed the generated code (although you do of course have all your code in a
147version control system anyway, don't you ...).
148
149
fc7ec1d9 150
03a53815 151=head1 SEE ALSO
152
4be535b1 153L<Catalyst::Manual>, L<Catalyst::Manual::Intro>
03a53815 154
fc7ec1d9 155=head1 AUTHOR
156
1c773d18 157Sebastian Riedel, C<sri@oook.de>,
158Andrew Ford, C<A.Ford@ford-mason.co.uk>
4be535b1 159
fc7ec1d9 160
161=head1 COPYRIGHT
162
4be535b1 163Copyright 2004-2005 Sebastian Riedel. All rights reserved.
fc7ec1d9 164
1c773d18 165This library is free software, you can redistribute it and/or modify it under
166the same terms as Perl itself.
fc7ec1d9 167
168=cut