Fixed up Moose strictness causing Gitalist to die.
broquaint [Mon, 5 Oct 2009 14:14:32 +0000 (15:14 +0100)]
Better approaches welcome.

README
lib/Gitalist.pm
lib/Gitalist/Model/Git.pm

diff --git a/README b/README
index f4294ca..cfddeac 100644 (file)
--- a/README
+++ b/README
@@ -30,6 +30,7 @@ DEPENDENCIES
   DateTime::Format::Mail
   File::Stat::ModeString
   List::MoreUtils
+  MooseX::Types::Common
   # Probably others ...
 
 COPYRIGHT AND LICENCE
index 0e8c2f3..16e0990 100644 (file)
@@ -15,11 +15,6 @@ our $VERSION = '0.01';
 # Bring in the libified gitweb.cgi.
 use gitweb;
 
-before 'setup' => sub {
-    my $app = shift;
-    $app->config('Model::Git' => { repo_dir => $app->config('repo_dir') });
-};
-
 __PACKAGE__->config(
        name => 'Gitalist',
        default_view => 'Default',
index 260bb26..77f324a 100644 (file)
@@ -15,13 +15,15 @@ use File::Stat::ModeString;
 use List::MoreUtils qw/any/;
 use File::Which;
 
+has repo_dir => ( isa => NonEmptySimpleStr, is => 'ro', lazy_build => 1 ); # Fixme - path::class
+has git      => ( isa => NonEmptySimpleStr, is => 'ro', lazy_build => 1 );
+
 sub BUILD {
     my ($self) = @_;
     $self->git; # Cause lazy value build.
+       $self->repo_dir;
 }
 
-has git => ( isa => NonEmptySimpleStr, is => 'ro', lazy_build => 1 );
-
 sub _build_git {
        my $git = File::Which::which('git');
 
@@ -35,6 +37,10 @@ EOR
        return $git;
 }
 
+sub _build_repo_dir {
+       return Gitalist->config->{repo_dir};
+}
+
 sub is_git_repo {
     my ($self, $dir) = @_;
 
@@ -81,8 +87,6 @@ sub get_project_properties {
     return %props;
 }
 
-has repo_dir => ( isa => NonEmptySimpleStr, required => 1, is => 'ro' ); # Fixme - path::class
-
 sub list_projects {
     my ($self) = @_;