Changed repos_dir to repo_dir in the COR model.
Dan Brook [Mon, 23 Jan 2012 23:23:43 +0000 (23:23 +0000)]
Unfortunately the name "repo_dir" is in the config files and the rest
of the code so the more sensible "repos_dir" (a directory containing
repositories) must step aside for now. Also the majority tests are
passing again which makes me happy.

lib/Gitalist/Model/CollectionOfRepos.pm
t/model_collectionofrepos.t

index 9f37fc5..08001e2 100644 (file)
@@ -35,11 +35,11 @@ sub _build_class {
     elsif ($self->repos) {
         return 'Gitalist::Git::CollectionOfRepositories::FromListOfDirectories';
     }
-    elsif ($self->repos_dir) {
+    elsif ($self->repo_dir) {
         return 'Gitalist::Git::CollectionOfRepositories::FromDirectory';
     }
     else {
-        return "Don't know where to get repositores from. Try a --repos_dir option, or setting up config";
+        return "Don't know where to get repositores from. Try a --repo_dir option, or setting up config";
     }
 }
 
@@ -68,11 +68,11 @@ has whitelist => (
 );
 
 # Simple directory of repositories (for list)
-has repos_dir => (
+has repo_dir => (
     is => 'ro',
     isa => DirOrUndef,
     coerce => 1,
-    builder => '_build_repos_dir',
+    builder => '_build_repo_dir',
     lazy => 1,
 );
 
@@ -83,7 +83,7 @@ has repos => (
     coerce => 1,
 );
 
-sub _build_repos_dir {
+sub _build_repo_dir {
     my $self = shift;
     return $ENV{GITALIST_REPO_DIR};
 }
@@ -93,13 +93,13 @@ sub build_per_context_instance {
 
     $self->class();
 
-    if ($self->repos_dir) { $self->repos_dir->resolve }
+    if ($self->repo_dir) { $self->repo_dir->resolve }
 
     my %args = (
         export_ok => $self->export_ok || '',
         $self->_has_whitelist ? (whitelist => $self->whitelist) : (),
         repos => $self->repos,
-        repo_dir => $self->repos_dir,
+        repo_dir => $self->repo_dir,
         vhost => $ctx->request->uri->host,
         %{ $self->args }
     );
@@ -130,7 +130,7 @@ Gitalist::Model::CollectionOfRepos - Model::CollectionOfRepos module for Gitalis
 This Model is a factory for an object implementing the L<Gitalist::Git::CollectionOfRepositories>
 interface.
 
-The simple options passed on the command line (like C<--repos_dir>), a class will by picked by default 
+The simple options passed on the command line (like C<--repo_dir>), a class will by picked by default 
 L<Gitalist::Git::CollectionOfRepositories::FromDirectory>.
 
 This can be overridden from config by explicitly passing in a class name and args for that class
index 0225ee6..5b0c601 100644 (file)
@@ -68,12 +68,12 @@ delete $ENV{GITALIST_REPO_DIR};
 throws_ok { my $i = Gitalist::Model::CollectionOfRepos->COMPONENT($ctx_gen->(), {}); $i->{_application} = $mock_ctx_meta->name; }
     qr/Don't know where to get repositores from/, 'Blows up nicely with no repos dir';
 
-throws_ok { Gitalist::Model::CollectionOfRepos->COMPONENT($ctx_gen->(), { repos_dir => '/does/not/exist' }) }
+throws_ok { Gitalist::Model::CollectionOfRepos->COMPONENT($ctx_gen->(), { repo_dir => '/does/not/exist' }) }
     qr|No such file or directory|, 'Blows up nicely with repos dir does not exist';
 
 {
     my $td = tempdir( CLEANUP => 1 );
-    test_with_config({ repos_dir => $td }, msg => 'repos_dir is tempdir');
+    test_with_config({ repo_dir => $td }, msg => 'repo_dir is tempdir');
     # NOTE - This is cheating, there isn't a real git repository here, so things will explode (hopefully)
     #        if we go much further..
     test_with_config({ repos => $td }, msg => 'repos is tempdir (scalar)');
@@ -103,13 +103,13 @@ throws_ok { Gitalist::Model::CollectionOfRepos->COMPONENT($ctx_gen->(), { repos
 }
 
 {
-    my $i = test_with_config({ repos_dir => "$FindBin::Bin/lib/repositories"});
+    my $i = test_with_config({ repo_dir => "$FindBin::Bin/lib/repositories"});
     is scalar($i->repositories->flatten), 3, 'Found 3 repos';
     isa_ok $i, 'Gitalist::Git::CollectionOfRepositories::FromDirectory';
 }
 
 {
-    my $i = test_with_config({ repos_dir => "$FindBin::Bin/lib/repositories", search_recursively => 1 });
+    my $i = test_with_config({ repo_dir => "$FindBin::Bin/lib/repositories", search_recursively => 1 });
     is scalar($i->repositories->flatten), 7, 'Found 7 repos recursively using config';
     isa_ok $i, 'Gitalist::Git::CollectionOfRepositories::FromDirectoryRecursive';
 }
@@ -117,7 +117,7 @@ throws_ok { Gitalist::Model::CollectionOfRepos->COMPONENT($ctx_gen->(), { repos
     my($tempfh, $wl) = tempfile(UNLINK => 1);
     print {$tempfh} "repo1";
     close $tempfh;
-    my $i = test_with_config({ repos_dir => "$FindBin::Bin/lib/repositories", whitelist => $wl });
+    my $i = test_with_config({ repo_dir => "$FindBin::Bin/lib/repositories", whitelist => $wl });
     is scalar($i->repositories->flatten), 1, 'Found 1 repos using whitelist';
     isa_ok $i, 'Gitalist::Git::CollectionOfRepositories::FromDirectory::WhiteList';
 }
@@ -134,7 +134,7 @@ throws_ok { Gitalist::Model::CollectionOfRepos->COMPONENT($ctx_gen->(), { repos
 
 {
     my $i = test_with_config({
-        repos_dir => "$FindBin::Bin/lib/repositories",
+        repo_dir => "$FindBin::Bin/lib/repositories",
         class    => 'TestModelSimple'
     });
     is scalar($i->repositories->flatten), 3, 'Found 3 repos';
@@ -143,7 +143,7 @@ throws_ok { Gitalist::Model::CollectionOfRepos->COMPONENT($ctx_gen->(), { repos
 
 {
     my $i = test_with_config({
-        repos_dir => "$FindBin::Bin/lib/repositories",
+        repo_dir => "$FindBin::Bin/lib/repositories",
         class    => 'TestModelFancy',
         args     => { fanciness => 1 },
     });