Bump version to 0.003006, update Changes and README.
[catagits/Gitalist.git] / script / gitalist_create.pl
CommitLineData
ba331b70 1#!/usr/bin/perl
42b626cd 2use FindBin;
4b3ff1cd 3BEGIN {
c7d034f8 4 my $env = "$FindBin::Bin/env";
4b3ff1cd 5 if (-r $env) {
6 do $env or die $@;
7 }
8}
89de6a33 9
10use strict;
11use warnings;
12use Getopt::Long;
13use Pod::Usage;
14eval "use Catalyst::Helper;";
15
16if ($@) {
17 die <<END;
18To use the Catalyst development tools including catalyst.pl and the
19generated script/myapp_create.pl you need Catalyst::Helper, which is
20part of the Catalyst-Devel distribution. Please install this via a
21vendor package or by running one of -
22
23 perl -MCPAN -e 'install Catalyst::Devel'
24 perl -MCPANPLUS -e 'install Catalyst::Devel'
25END
26}
27
28my $force = 0;
29my $mech = 0;
30my $help = 0;
31
32GetOptions(
33 'nonew|force' => \$force,
34 'mech|mechanize' => \$mech,
35 'help|?' => \$help
36 );
37
38pod2usage(1) if ( $help || !$ARGV[0] );
39
40my $helper = Catalyst::Helper->new( { '.newfiles' => !$force, mech => $mech } );
41
42pod2usage(1) unless $helper->mk_component( 'Gitalist', @ARGV );
43
441;
45
46=head1 NAME
47
48gitalist_create.pl - Create a new Catalyst Component
49
50=head1 SYNOPSIS
51
52gitalist_create.pl [options] model|view|controller name [helper] [options]
53
54 Options:
55 -force don't create a .new file where a file to be created exists
56 -mechanize use Test::WWW::Mechanize::Catalyst for tests if available
57 -help display this help and exits
58
59 Examples:
60 gitalist_create.pl controller My::Controller
61 gitalist_create.pl -mechanize controller My::Controller
62 gitalist_create.pl view My::View
63 gitalist_create.pl view MyView TT
64 gitalist_create.pl view TT TT
65 gitalist_create.pl model My::Model
66 gitalist_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\
67 dbi:SQLite:/tmp/my.db
68 gitalist_create.pl model AnotherDB DBIC::Schema MyApp::Schema create=static\
69 dbi:Pg:dbname=foo root 4321
70
71 See also:
72 perldoc Catalyst::Manual
73 perldoc Catalyst::Manual::Intro
74
75=head1 DESCRIPTION
76
77Create a new Catalyst Component.
78
79Existing component files are not overwritten. If any of the component files
80to be created already exist the file will be written with a '.new' suffix.
81This behavior can be suppressed with the C<-force> option.
82
83=head1 AUTHORS
84
85Catalyst Contributors, see Catalyst.pm
86
87=head1 COPYRIGHT
88
89This library is free software. You can redistribute it and/or modify
90it under the same terms as Perl itself.
91
92=cut