Implement auto restart when the app is updated
[catagits/Gitalist.git] / lib / Gitalist / Model / GitRepos.pm
1 package Gitalist::Model::GitRepos;
2
3 use Moose;
4 use Gitalist::Git::Repo;
5 use namespace::autoclean;
6
7 extends 'Catalyst::Model';
8 with 'Catalyst::Component::InstancePerContext'; # Note we only need to be
9                                                 # InstancePerContext as we nick
10                                                 # the config from the other
11                                                 # model. Once we take over just
12                                                 # use ::Model::Adaptor
13
14 sub build_per_context_instance {
15     my ( $self, $c ) = @_;
16
17     return Gitalist::Git::Repo->new(
18         repo_dir => $c->model('Git')->repo_dir,
19     );
20 }
21
22 __PACKAGE__->meta->make_immutable;
23