Too slow
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Script / Create.pm
CommitLineData
0ba6e8aa 1package Catalyst::Script::Create;
a24a5860 2use Moose;
4ebd5ecf 3use strict;
4use warnings;
5use Getopt::Long;
6use Pod::Usage;
7use Catalyst::Helper;
8
2824ec8d 9sub new_with_options { shift->new }
10
11sub run {
12 my ($appname) = @_;
4ebd5ecf 13my $force = 0;
14my $mech = 0;
15my $help = 0;
16
17GetOptions(
18 'nonew|force' => \$force,
19 'mech|mechanize' => \$mech,
20 'help|?' => \$help
21 );
22
23pod2usage(1) if ( $help || !$ARGV[0] );
24
25my $helper = Catalyst::Helper->new( { '.newfiles' => !$force, mech => $mech } );
26
2824ec8d 27pod2usage(1) unless $helper->mk_component( $appname, @ARGV );
28
29}
4ebd5ecf 30
0ba6e8aa 311;
4ebd5ecf 32
33=head1 NAME
34
35boyosplace_create.pl - Create a new Catalyst Component
36
37=head1 SYNOPSIS
38
39boyosplace_create.pl [options] model|view|controller name [helper] [options]
40
41 Options:
42 -force don't create a .new file where a file to be created exists
43 -mechanize use Test::WWW::Mechanize::Catalyst for tests if available
44 -help display this help and exits
45
46 Examples:
47 boyosplace_create.pl controller My::Controller
48 boyosplace_create.pl controller My::Controller BindLex
49 boyosplace_create.pl -mechanize controller My::Controller
50 boyosplace_create.pl view My::View
51 boyosplace_create.pl view MyView TT
52 boyosplace_create.pl view TT TT
53 boyosplace_create.pl model My::Model
54 boyosplace_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\
55 dbi:SQLite:/tmp/my.db
56 boyosplace_create.pl model AnotherDB DBIC::Schema MyApp::Schema create=static\
57 dbi:Pg:dbname=foo root 4321
58
59 See also:
60 perldoc Catalyst::Manual
61 perldoc Catalyst::Manual::Intro
62
63=head1 DESCRIPTION
64
65Create a new Catalyst Component.
66
67Existing component files are not overwritten. If any of the component files
68to be created already exist the file will be written with a '.new' suffix.
69This behavior can be suppressed with the C<-force> option.
70
71=head1 AUTHORS
72
73Catalyst Contributors, see Catalyst.pm
74
75=head1 COPYRIGHT
76
77This library is free software, you can redistribute it and/or modify
78it under the same terms as Perl itself.
79
80=cut