3 class Gitalist::Git::Repo with Gitalist::Git::CollectionOfProjects {
4 use MooseX::Types::Common::String qw/NonEmptySimpleStr/;
5 use MooseX::Types::Path::Class qw/Dir/;
15 # Make sure repo_dir is an absolute path so that
16 # ->contains() works correctly.
17 $self->repo_dir->resolve;
20 method _get_path_for_project_name (NonEmptySimpleStr $name) {
21 my $path = $self->repo_dir->subdir($name)->resolve;
22 die "Directory traversal prohibited"
23 unless $self->repo_dir->contains($path);
28 method _build_projects {
29 my $dh = $self->repo_dir->open || die "Could not open repo_dir";
31 while (my $dir_entry = $dh->read) {
32 # try to get a project for each entry in repo_dir
34 my $p = $self->get_project($dir_entry);
46 Gitalist::Git::Repo - Model of a repository directory
50 my $repo = Gitalist::Git::Repo->new( repo_dir => $Dir );
51 my $project_list = $repo->projects;
52 my $first_project = $project_list->[0];
53 my $named_project = $repo->get_project('Gitalist');
57 This class models a Gitalist Repo, which is a collection of
58 Projects (git repositories). It is used for creating Project
64 =head2 repo_dir (C<Path::Class::Dir>)
66 The filesystem root of the C<Repo>.
70 An array of all L<Gitalist::Git::Project>s found in C<repo_dir>.
76 =head2 get_project (Str $name)
78 Returns a L<Gitalist::Git::Project> for the given name.
79 If C<$name> is not a valid git repository under C<$repo_dir>, an exception
86 L<Gitalist::Git::Project>
91 See L<Gitalist> for authors.
95 See L<Gitalist> for the license.