4fe10c4d91433cb6c5ffa80ec01c08f3dc6905e2
[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 #extends qw(MooseX::App::Cmd);
11
12 has _app => (
13     reader   => 'app',
14     init_arg => 'app',
15     traits => [qw(NoGetopt)],
16     isa => Str,
17     is => 'ro',
18 );
19
20 has help => (
21     traits => [qw(Getopt)],
22     cmd_aliases => 'h',
23     isa => Bool,
24     is => 'ro',
25     documentation => qq{ display this help and exits },
26 );
27
28
29 sub run {
30     my $self = shift;
31
32     Class::MOP::load_class("Catalyst::Test");
33     Catalyst::Test->import($self->app);
34
35     pod2usage(1) if ( $self->help || !$ARGV[1] );
36     print request($ARGV[1])->content  . "\n";
37
38 }
39
40
41 __PACKAGE__->meta->make_immutable;
42 1;