Gave Repo a method to return a Project.
Zachary Stevens [Fri, 6 Nov 2009 21:00:38 +0000 (21:00 +0000)]
lib/Gitalist/Git/Repo.pm
t/git/repo.t

index 6470cbf..db035a5 100644 (file)
@@ -8,6 +8,15 @@ class Gitalist::Git::Repo {
                       is => 'ro',
                       required => 1 );
 
+    method project (NonEmptySimpleStr $project) {
+        my $pd = $self->dir_from_project_name($project);
+        return Gitalist::Git::Project->new(
+            name => $project,
+            path => $pd,
+        );
+    }
+
+
 =head2 _is_git_repo
 
 Determine whether a given directory (as a L<Path::Class::Dir> object) is a
index a46cf8e..274ac23 100644 (file)
@@ -15,3 +15,6 @@ is($repo->repo_dir, $repo_dir, "repo->repo_dir is correct" );
 
 my $project_list = $repo->list_projects;
 isa_ok(@$project_list[0], 'Gitalist::Git::Project');
+
+my $project = $repo->project('repo1');
+isa_ok($project, 'Gitalist::Git::Project');