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