Commit | Line | Data |
fc7ec1d9 |
1 | #!/usr/bin/perl -w |
2 | |
3 | use strict; |
4 | use Getopt::Long; |
5 | use Pod::Usage; |
6 | use Catalyst::Helper; |
7 | |
4e90e3c1 |
8 | my $force = 0; |
9 | my $help = 0; |
10 | my $makefile = 0; |
11 | my $scripts = 0; |
12 | my $short = 0; |
fc7ec1d9 |
13 | |
1c773d18 |
14 | GetOptions( |
640faa87 |
15 | 'help|?' => \$help, |
16 | 'force|nonew' => \$force, |
4e90e3c1 |
17 | 'makefile' => \$makefile, |
640faa87 |
18 | 'scripts' => \$scripts, |
19 | 'short' => \$short |
1c773d18 |
20 | ); |
fc7ec1d9 |
21 | |
22 | pod2usage(1) if ( $help || !$ARGV[0] ); |
23 | |
4e90e3c1 |
24 | my $helper = Catalyst::Helper->new( { |
25 | '.newfiles' => !$force, |
26 | 'makefile' => $makefile, |
27 | 'scripts' => $scripts, |
28 | 'short' => $short, |
29 | } ); |
fc7ec1d9 |
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 | |
d459eb44 |
41 | catalyst.pl [options] application-name |
fc7ec1d9 |
42 | |
b4b01a8a |
43 | 'catalyst.pl' creates a skeleton for a new application, and allows you to |
44 | upgrade the skeleton of your old application. |
45 | |
fc7ec1d9 |
46 | Options: |
640faa87 |
47 | -force don't create a .new file where a file to be created exists |
b4b01a8a |
48 | -help display this help and exit |
49 | -makefile only update Makefile.PL |
50 | -scripts only update helper scripts |
51 | -short use short names, M/V/C instead of Model/View/Controller. |
52 | |
53 | application-name must be a valid Perl module name and can include "::", |
54 | which will be converted to '-' in the project name. |
fc7ec1d9 |
55 | |
fc7ec1d9 |
56 | |
57 | Examples: |
d459eb44 |
58 | catalyst.pl My::App |
59 | catalyst.pl MyApp |
fc7ec1d9 |
60 | |
ae1e6b59 |
61 | To upgrade your app to a new version of Catalyst: |
640faa87 |
62 | catalyst.pl -force -scripts MyApp |
ae1e6b59 |
63 | |
03a53815 |
64 | |
fc7ec1d9 |
65 | =head1 DESCRIPTION |
66 | |
4be535b1 |
67 | The C<catalyst.pl> script bootstraps a Catalyst application, creating a |
68 | directory structure populated with skeleton files. |
69 | |
70 | The application name must be a valid Perl module name. The name of the |
71 | directory created is formed from the application name supplied, with double |
72 | colons replaced with hyphens (so, for example, the directory for C<My::App> is |
73 | C<My-App>). |
74 | |
75 | Using the example application name C<My::App>, the application directory will |
76 | contain the following items: |
77 | |
78 | =over 4 |
79 | |
80 | =item README |
81 | |
82 | a skeleton README file, which you are encouraged to expand on |
83 | |
4be535b1 |
84 | =item Changes |
85 | |
86 | a changes file with an initial entry for the creation of the application |
87 | |
88 | =item Makefile.PL |
89 | |
b1882228 |
90 | Makefile.PL uses the C<Module::Install> system for packaging and distribution |
91 | of the application. |
4be535b1 |
92 | |
93 | =item lib |
94 | |
95 | contains the application module (C<My/App.pm>) and |
96 | subdirectories for model, view, and controller components (C<My/App/M>, |
97 | C<My/App/V>, and C<My/App/C>). |
98 | |
99 | =item root |
100 | |
101 | root directory for your web document content. This is left empty. |
102 | |
103 | =item script |
104 | |
105 | a directory containing helper scripts: |
106 | |
107 | =over 4 |
108 | |
b1882228 |
109 | =item C<myapp_create.pl> |
4be535b1 |
110 | |
111 | helper script to generate new component modules |
112 | |
b1882228 |
113 | =item C<myapp_server.pl> |
4be535b1 |
114 | |
115 | runs the generated application within a Catalyst test server, which can be |
116 | used for testing without resorting to a full-blown web server configuration. |
117 | |
b1882228 |
118 | =item C<myapp_cgi.pl> |
4be535b1 |
119 | |
120 | runs the generated application as a CGI script |
121 | |
b1882228 |
122 | =item C<myapp_fastcgi.pl> |
4be535b1 |
123 | |
124 | runs the generated application as a FastCGI script |
125 | |
b1882228 |
126 | =item C<myapp_test.pl> |
4be535b1 |
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, |
1c773d18 |
140 | although it reacts to all requests by outputting a friendly welcome screen. |
4be535b1 |
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 | |
fc7ec1d9 |
156 | |
03a53815 |
157 | =head1 SEE ALSO |
158 | |
4be535b1 |
159 | L<Catalyst::Manual>, L<Catalyst::Manual::Intro> |
03a53815 |
160 | |
fc7ec1d9 |
161 | =head1 AUTHOR |
162 | |
1c773d18 |
163 | Sebastian Riedel, C<sri@oook.de>, |
164 | Andrew Ford, C<A.Ford@ford-mason.co.uk> |
4be535b1 |
165 | |
fc7ec1d9 |
166 | |
167 | =head1 COPYRIGHT |
168 | |
4be535b1 |
169 | Copyright 2004-2005 Sebastian Riedel. All rights reserved. |
fc7ec1d9 |
170 | |
1c773d18 |
171 | This library is free software, you can redistribute it and/or modify it under |
172 | the same terms as Perl itself. |
fc7ec1d9 |
173 | |
174 | =cut |