coerce => 1,
);
+ method debug_string { 'repository directory ' . $self->repo_dir }
+
method BUILD {
# Make sure repo_dir is an absolute path so that
# ->contains() works correctly.
$self->repo_dir->resolve;
}
- method _get_path_for_project_name (NonEmptySimpleStr $name) {
+ method _get_path_for_repository_name (NonEmptySimpleStr $name) {
my $path = $self->repo_dir->subdir($name)->resolve;
die "Directory traversal prohibited"
unless $self->repo_dir->contains($path);
return $path;
}
+ method _get_repo_from_name (NonEmptySimpleStr $name) {
+ return Gitalist::Git::Repository->new($self->_get_path_for_repository_name($name));
+ }
+
## Builders
- method _build_projects {
+ method _build_repositories {
my $dh = $self->repo_dir->open || die "Could not open repo_dir";
my @ret;
while (my $dir_entry = $dh->read) {
- # try to get a project for each entry in repo_dir
+ # try to get a repository for each entry in repo_dir
eval {
- my $p = $self->get_project($dir_entry);
+ my $p = $self->get_repository($dir_entry);
push @ret, $p;
};
}
=head1 NAME
-Gitalist::Git::CollectionOfRepositories::FromDirectory - Model of a repository directory
+Gitalist::Git::CollectionOfRepositories::FromDirectory - Model of a directory containing git repositories
=head1 SYNOPSIS
my $repo = Gitalist::Git::CollectionOfRepositories::FromDirectory->new( repo_dir => $Dir );
- my $project_list = $repo->projects;
- my $first_project = $project_list->[0];
- my $named_project = $repo->get_project('Gitalist');
+ my $repository_list = $repo->repositories;
+ my $first_repository = $repository_list->[0];
+ my $named_repository = $repo->get_repository('Gitalist');
=head1 DESCRIPTION
-This class models a Gitalist Repo, which is a collection of
-Projects (git repositories). It is used for creating Project
-objects to work with.
-
+This class provides a list of Repositories found in the given directory.
=head1 ATTRIBUTES
The filesystem root of the C<Repo>.
-=head2 projects
-
-An array of all L<Gitalist::Git::Repository>s found in C<repo_dir>.
-
-
-
-=head1 METHODS
-
-=head2 get_project (Str $name)
-
-Returns a L<Gitalist::Git::Repository> for the given name.
-If C<$name> is not a valid git repository under C<$repo_dir>, an exception
-will be thrown.
-
-
-
=head1 SEE ALSO
-L<Gitalist::Git::Repository>
-
+L<Gitalist::Git::CollectionOfRepositories>, L<Gitalist::Git::Repository>
=head1 AUTHORS