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