Pass repo dir correctly
Tomas Doran [Mon, 2 Nov 2009 20:20:04 +0000 (20:20 +0000)]
lib/Gitalist/Model/Git.pm

index 3ae1188..fb16221 100644 (file)
@@ -2,11 +2,14 @@ package Gitalist::Model::Git;
 
 use Moose;
 use namespace::autoclean;
+use MooseX::Types::Common::String qw/NonEmptySimpleStr/;
 use Moose::Autobox;
 
 extends 'Catalyst::Model';
 with 'Catalyst::Component::InstancePerContext';
 
+has repo_dir => ( is => 'ro', required => 1, isa => NonEmptySimpleStr );
+
 =head1 NAME
 
 Gitalist::Model::Git - the model for git interactions
@@ -27,7 +30,7 @@ sub build_per_context_instance {
   my $app = blessed($c) || $c;
   my $model = Git::Repos->new(
     project => ([$c->req->parameters->{p} || '/']->flatten)[0],
-    repo_dir => $app->config->{repo_dir}, # FIXME - Move to model config
+    repo_dir => $self->repo_dir,
   );
 
   # This is fugly as fuck. Move Git::PurePerl construction into attribute builders..