3 class Gitalist::Git::Repo with Gitalist::Git::HasUtils {
4 use MooseX::Types::Common::String qw/NonEmptySimpleStr/;
5 use MooseX::Types::Path::Class qw/Dir/;
6 use MooseX::Types::Moose qw/ArrayRef/;
7 use aliased 'Gitalist::Git::Project';
9 # FIXME - this is nasty as we build the Git::Utils thing without a project name
10 # should refactor or something?
12 Gitalist::Git::Util->new();
22 method project (NonEmptySimpleStr $project) {
25 path => $self->repo_dir->subdir($project),
32 Determine whether a given directory (as a L<Path::Class::Dir> object) is a
37 method _is_git_repo ($dir) {
38 return -f $dir->file('HEAD') || -f $dir->file('.git', 'HEAD');
43 For the C<repo_dir> specified in the config return an array of projects where
44 each item will contain the contents of L</project_info>.
49 isa => ArrayRef['Gitalist::Git::Project'],
50 reader => 'list_projects',
54 method _build_projects {
55 my $base = $self->repo_dir;
56 my $dh = $base->open || die "Could not open $base";
58 while (my $file = $dh->read) {
59 next if $file =~ /^.{1,2}$/;
61 my $obj = $base->subdir($file);
63 next unless $self->_is_git_repo($obj);
65 push @ret, $self->project($file);
68 return [sort { $a->name cmp $b->name } @ret];