added MX::Types::Moose, cleaned up moar
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Script / Test.pm
CommitLineData
0ba6e8aa 1package Catalyst::Script::Test;
accb0640 2use Moose;
451b2a44 3use Pod::Usage;
4use FindBin;
5use lib "$FindBin::Bin/../lib";
6with 'MooseX::Getopt';
4e45780e 7use MooseX::Types::Moose qw/Str Bool/;
d9a32f71 8use namespace::autoclean;
451b2a44 9
d9a32f71 10has _app => (
11 reader => 'app',
12 init_arg => 'app',
13 traits => [qw(NoGetopt)],
73e4f0f1 14 isa => Str,
d9a32f71 15 is => 'ro',
16);
17
18has help => (
19 traits => [qw(Getopt)],
20 cmd_aliases => 'h',
73e4f0f1 21 isa => Bool,
d9a32f71 22 is => 'ro',
23 documentation => qq{ display this help and exits },
24);
451b2a44 25
26
27sub run {
28 my $self = shift;
29
30 Class::MOP::load_class("Catalyst::Test");
31 Catalyst::Test->import($self->app);
57dc50b0 32
451b2a44 33 pod2usage(1) if ( $self->help || !$ARGV[1] );
34 print request($ARGV[1])->content . "\n";
57dc50b0 35
451b2a44 36}
37
73e4f0f1 38
d6e8e664 39__PACKAGE__->meta->make_immutable;
0ba6e8aa 401;