Bump version to 0.004002 and update Changes.
[catagits/Gitalist.git] / lib / Gitalist / TraitFor / Script.pm
CommitLineData
7f9d2ed9 1package Gitalist::TraitFor::Script;
a18818fd 2use Moose::Role;
5e26dc93 3use MooseX::Types::Moose qw/ Undef /;
a18818fd 4use MooseX::Types::Common::String qw/NonEmptySimpleStr/;
5use namespace::autoclean;
6
7has repo_dir => (
5e26dc93 8 isa => Undef | NonEmptySimpleStr,
9 is => 'ro',
10 default => sub {
11 return unless exists $ENV{GITALIST_REPO_DIR};
12 $ENV{GITALIST_REPO_DIR};
13 },
a18818fd 14);
15
6537d25e 16around run => sub {
17 my $orig = shift;
18 my $self = shift;
6537d25e 19 local $ENV{GITALIST_REPO_DIR} = $self->repo_dir;
20 $self->$orig(@_);
21};
22
a18818fd 231;
24
e56c039f 25=head1 NAME
26
27Gitalist::ScriptRole - Role for Gitalist scripts.
28
29=head1 DESCRIPTION
30
31Wraps the run method in Catalyst scripts to apply the C<< --repo_dir >>
32option.
33
34=head1 AUTHORS
35
36See L<Gitalist> for authors.
37
38=head1 LICENSE
39
40See L<Gitalist> for the license.
41
42=cut