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