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