Use new Catalyst features
[catagits/Gitalist.git] / lib / Gitalist / TraitFor / Script.pm
1 package Gitalist::TraitFor::Script;
2 use Moose::Role;
3 use MooseX::Types::Moose qw/ Undef /;
4 use MooseX::Types::Common::String qw/NonEmptySimpleStr/;
5 use namespace::autoclean;
6
7 has repo_dir => (
8     isa => Undef | NonEmptySimpleStr,
9     is => 'ro',
10     default => sub {
11         return unless exists $ENV{GITALIST_REPO_DIR};
12         $ENV{GITALIST_REPO_DIR};
13     },
14 );
15
16 1;
17
18 =head1 NAME
19
20 Gitalist::ScriptRole - Role for Gitalist scripts.
21
22 =head1 DESCRIPTION
23
24 Wraps the run method in Catalyst scripts to apply the C<< --repo_dir >>
25 option.
26
27 =head1 AUTHORS
28
29 See L<Gitalist> for authors.
30
31 =head1 LICENSE
32
33 See L<Gitalist> for the license.
34
35 =cut