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