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