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