Improved message in 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;
34d28dfd 6eval 'use Catalyst::Helper "1.0";';
d1338286 7
8if ($@) {
9 die <<END;
10To use the Catalyst development tools including catalyst.pl and the
11generated script/myapp_create.pl you need Catalyst::Helper, which is
12part of the Catalyst-Devel distribution. Please install this via a
13vendor package or by running one of -
14
15 perl -MCPAN -e 'install Catalyst::Devel'
16 perl -MCPANPLUS -e 'install Catalyst::Devel'
17END
18
19}
fc7ec1d9 20
4e90e3c1 21my $force = 0;
22my $help = 0;
23my $makefile = 0;
24my $scripts = 0;
25my $short = 0;
fc7ec1d9 26
1c773d18 27GetOptions(
640faa87 28 'help|?' => \$help,
29 'force|nonew' => \$force,
4e90e3c1 30 'makefile' => \$makefile,
640faa87 31 'scripts' => \$scripts,
32 'short' => \$short
1c773d18 33);
fc7ec1d9 34
35pod2usage(1) if ( $help || !$ARGV[0] );
36
34d28dfd 37my $helper = Catalyst::Helper->new(
38 {
39 '.newfiles' => !$force,
40 'makefile' => $makefile,
41 'scripts' => $scripts,
42 'short' => $short,
43 }
44);
fc7ec1d9 45pod2usage(1) unless $helper->mk_app( $ARGV[0] );
46
471;
48__END__
49
50=head1 NAME
51
52catalyst - Bootstrap a Catalyst application
53
54=head1 SYNOPSIS
55
d459eb44 56catalyst.pl [options] application-name
fc7ec1d9 57
b4b01a8a 58'catalyst.pl' creates a skeleton for a new application, and allows you to
59upgrade the skeleton of your old application.
60
fc7ec1d9 61 Options:
640faa87 62 -force don't create a .new file where a file to be created exists
b4b01a8a 63 -help display this help and exit
64 -makefile only update Makefile.PL
65 -scripts only update helper scripts
66 -short use short names, M/V/C instead of Model/View/Controller.
67
68 application-name must be a valid Perl module name and can include "::",
69 which will be converted to '-' in the project name.
fc7ec1d9 70
fc7ec1d9 71
72 Examples:
d459eb44 73 catalyst.pl My::App
74 catalyst.pl MyApp
fc7ec1d9 75
ae1e6b59 76 To upgrade your app to a new version of Catalyst:
640faa87 77 catalyst.pl -force -scripts MyApp
ae1e6b59 78
03a53815 79
fc7ec1d9 80=head1 DESCRIPTION
81
4be535b1 82The C<catalyst.pl> script bootstraps a Catalyst application, creating a
83directory structure populated with skeleton files.
84
85The application name must be a valid Perl module name. The name of the
86directory created is formed from the application name supplied, with double
87colons replaced with hyphens (so, for example, the directory for C<My::App> is
88C<My-App>).
89
90Using the example application name C<My::App>, the application directory will
91contain the following items:
92
93=over 4
94
95=item README
96
97a skeleton README file, which you are encouraged to expand on
98
4be535b1 99=item Changes
100
101a changes file with an initial entry for the creation of the application
102
103=item Makefile.PL
104
b1882228 105Makefile.PL uses the C<Module::Install> system for packaging and distribution
106of the application.
4be535b1 107
108=item lib
109
110contains the application module (C<My/App.pm>) and
111subdirectories for model, view, and controller components (C<My/App/M>,
112C<My/App/V>, and C<My/App/C>).
113
114=item root
115
116root directory for your web document content. This is left empty.
117
118=item script
119
120a directory containing helper scripts:
121
122=over 4
123
b1882228 124=item C<myapp_create.pl>
4be535b1 125
126helper script to generate new component modules
127
b1882228 128=item C<myapp_server.pl>
4be535b1 129
130runs the generated application within a Catalyst test server, which can be
131used for testing without resorting to a full-blown web server configuration.
132
b1882228 133=item C<myapp_cgi.pl>
4be535b1 134
135runs the generated application as a CGI script
136
b1882228 137=item C<myapp_fastcgi.pl>
4be535b1 138
139runs the generated application as a FastCGI script
140
b1882228 141=item C<myapp_test.pl>
4be535b1 142
143runs an action of the generated application from the comand line.
144
145=back
146
147=item t
148
149test directory
150
151=back
152
153
154The application module generated by the C<catalyst.pl> script is functional,
1c773d18 155although it reacts to all requests by outputting a friendly welcome screen.
4be535b1 156
157
158=head1 NOTE
159
160Neither C<catalyst.pl> nor the generated helper script will overwrite existing
161files. In fact the scripts will generate new versions of any existing files,
162adding the extension C<.new> to the filename. The C<.new> file is not created
163if would be identical to the existing file.
164
165This means you can re-run the scripts for example to see if newer versions of
166Catalyst or its plugins generate different code, or to see how you may have
167changed the generated code (although you do of course have all your code in a
168version control system anyway, don't you ...).
169
170
fc7ec1d9 171
03a53815 172=head1 SEE ALSO
173
4be535b1 174L<Catalyst::Manual>, L<Catalyst::Manual::Intro>
03a53815 175
fc7ec1d9 176=head1 AUTHOR
177
1c773d18 178Sebastian Riedel, C<sri@oook.de>,
179Andrew Ford, C<A.Ford@ford-mason.co.uk>
4be535b1 180
fc7ec1d9 181
182=head1 COPYRIGHT
183
4be535b1 184Copyright 2004-2005 Sebastian Riedel. All rights reserved.
fc7ec1d9 185
1c773d18 186This library is free software, you can redistribute it and/or modify it under
187the same terms as Perl itself.
fc7ec1d9 188
189=cut