Rename the Catalyst model to be in line with everything else. BREAKS CURRENT INSTALLS...
Tomas Doran [Sun, 17 Jan 2010 17:35:09 +0000 (17:35 +0000)]
Changes
gitalist.conf
gitalist_local.conf
lib/Gitalist.pm
lib/Gitalist/Controller/Root.pm
lib/Gitalist/Model/CollectionOfRepos.pm [moved from lib/Gitalist/Model/GitRepos.pm with 98% similarity]
t/gitalist.conf
t/model_collectionofrepos.t [moved from t/model_gitrepos.t with 77% similarity]

diff --git a/Changes b/Changes
index 884b574..e9c27bd 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,11 @@
 This file documents the revision history for Perl extension Gitalist.
 
+    - BIG BREAKING CHANGE - Gitalist::Model::GitRepos has been renamed
+      Gitalist::Model::CollectionOfRepos. You need to fix your config and
+      if you have actually installed Gitalist - remove the old model file.
+
     - Bump required version of Git::PurePerl for Encoding fixes.
+
     - Fix Makefile.PL to not need release deps when checking out of Git.
 
 0.000005 2010-01-09
index 98b3160..d2e747c 100644 (file)
@@ -1,10 +1,10 @@
 name Gitalist
 
-<Model::GitRepos>
+<Model::CollectionOfRepos>
     #git /path/to/git
     # Configure this to where your repositories are.
     # repo_dir __path_to(../)__
-</Model::GitRepos>
+</Model::CollectionOfRepos>
 
 sitename "A Gitalist"
 
index bd77889..2729895 100644 (file)
@@ -1,8 +1,8 @@
-<Model::GitRepos>
+<Model::CollectionOfRepos>
     # This is set so that if you run Gitalist out of a git checkout then you
     # can browse the repositories the directory level above your checkout.
     # This file is suppressed from the built dist by MANIFEST.SKIP, so you
     # don't have this config if you install from CPAN.
     repo_dir __path_to(../)__
-</Model::GitRepos>
+</Model::CollectionOfRepos>
 
index c59a836..41bfd04 100644 (file)
@@ -19,7 +19,7 @@ $VERSION = eval $VERSION;
 __PACKAGE__->config(
     name => 'Gitalist',
     default_view => 'Default',
-    default_model => 'GitRepos',
+    default_model => 'CollectionOfRepos',
 );
 
 __PACKAGE__->setup();
index 396296c..b2e60be 100644 (file)
@@ -438,7 +438,6 @@ The action for the search form.
 
 sub search : Chained('base') Args(0) {
   my($self, $c) = @_;
-  $c->stash(current_action => 'GitRepos');
   my $repository = $c->stash->{Repository};
   my $commit  = $self->_get_object($c);
   # Lifted from /shortlog.
@@ -629,7 +628,7 @@ sub base : Chained('/root') PathPart('') CaptureArgs(0) {
   my $repository = $c->req->param('p');
   if (defined $repository) {
     eval {
-      $c->stash(Repository => $c->model('GitRepos')->get_repository($repository));
+      $c->stash(Repository => $c->model()->get_repository($repository));
     };
     if ($@) {
       $c->detach('/error_404');
similarity index 98%
rename from lib/Gitalist/Model/GitRepos.pm
rename to lib/Gitalist/Model/CollectionOfRepos.pm
index deff310..2820b53 100644 (file)
@@ -1,4 +1,4 @@
-package Gitalist::Model::GitRepos;
+package Gitalist::Model::CollectionOfRepos;
 
 use Moose;
 use Gitalist::Git::CollectionOfRepositories::FromDirectory;
index 6617816..e5661a1 100644 (file)
@@ -1,6 +1,6 @@
-<Model::GitRepos>
+<Model::CollectionOfRepos>
     repo_dir __path_to(t/lib/repositories)__
-</Model::GitRepos>
+</Model::CollectionOfRepos>
 
 name Gitalist
 
similarity index 77%
rename from t/model_gitrepos.t
rename to t/model_collectionofrepos.t
index ee78cb6..e847c33 100644 (file)
@@ -12,9 +12,9 @@ use Class::MOP::Class;
 use Catalyst::Request;
 use Catalyst::Response;
 use Catalyst::Utils;
-use Gitalist::Model::GitRepos;
+use Gitalist::Model::CollectionOfRepos;
 use File::Temp qw/tempdir/;
+
 my $mock_ctx_meta = Class::MOP::Class->create_anon_class( superclasses => ['Moose::Object'] );
 $mock_ctx_meta->add_attribute($_, accessor => $_, required => 1) for qw/request response/;
 $mock_ctx_meta->add_attribute('stash', accessor => 'stash', required => 1, default => sub { {} });
@@ -48,10 +48,10 @@ our $ctx_gen = sub {
 local %ENV = %ENV;
 delete $ENV{GITALIST_REPO_DIR};
 
-throws_ok { Gitalist::Model::GitRepos->COMPONENT($ctx_gen->(), {}) }
+throws_ok { Gitalist::Model::CollectionOfRepos->COMPONENT($ctx_gen->(), {}) }
     qr/Cannot find repository dir/, 'Blows up nicely with no repos dir';
 
-throws_ok { Gitalist::Model::GitRepos->COMPONENT($ctx_gen->(), { repo_dir => '/does/not/exist' }) }
+throws_ok { Gitalist::Model::CollectionOfRepos->COMPONENT($ctx_gen->(), { repo_dir => '/does/not/exist' }) }
     qr|Cannot find repository dir: "/does/not/exist"|, 'Blows up nicely with repos dir does not exist';
 
 {
@@ -64,25 +64,25 @@ throws_ok { Gitalist::Model::GitRepos->COMPONENT($ctx_gen->(), { repo_dir => '/d
 }
 
 # Note - we treat an empty list of repos as if it doesn't exist at all.
-throws_ok { Gitalist::Model::GitRepos->COMPONENT($ctx_gen->(), { repos => [] } ) }
+throws_ok { Gitalist::Model::CollectionOfRepos->COMPONENT($ctx_gen->(), { repos => [] } ) }
     qr/Cannot find repository dir/, 'Blows up nicely with no repos list';
 
-throws_ok { Gitalist::Model::GitRepos->COMPONENT($ctx_gen->(), { repos => [ '/does/not/exist' ] } ) }
+throws_ok { Gitalist::Model::CollectionOfRepos->COMPONENT($ctx_gen->(), { repos => [ '/does/not/exist' ] } ) }
     qr/Cannot find repository directories/, 'Blows up nicely with repos list - 1 unknown item (array)';
-throws_ok { Gitalist::Model::GitRepos->COMPONENT($ctx_gen->(), { repos => '/does/not/exist' } ) }
+throws_ok { Gitalist::Model::CollectionOfRepos->COMPONENT($ctx_gen->(), { repos => '/does/not/exist' } ) }
     qr/Cannot find repository directories/, 'Blows up nicely with repos list - 1 unknown item (scalar))';
 
-throws_ok { Gitalist::Model::GitRepos->COMPONENT($ctx_gen->(), { repos => [ '/does/not/exist', '/also/does/not/exist' ] } ) }
+throws_ok { Gitalist::Model::CollectionOfRepos->COMPONENT($ctx_gen->(), { repos => [ '/does/not/exist', '/also/does/not/exist' ] } ) }
     qr/Cannot find repository directories/, 'Blows up nicely with repos list - 2 unknown items';
 
-throws_ok { Gitalist::Model::GitRepos->COMPONENT($ctx_gen->(), { repos => [ tempdir( CLEANUP => 1), '/also/does/not/exist' ] } ) }
+throws_ok { Gitalist::Model::CollectionOfRepos->COMPONENT($ctx_gen->(), { repos => [ tempdir( CLEANUP => 1), '/also/does/not/exist' ] } ) }
     qr|Cannot find repository directories.*/also/does/not/exist|, 'Blows up nicely with repos list - 1 known, 1 unknown items';
 
 {
     my $td = tempdir( CLEANUP => 1 );
     local %ENV = %ENV;
     $ENV{GITALIST_REPO_DIR} = $td;
-    lives_ok { Gitalist::Model::GitRepos->COMPONENT($ctx_gen->(), {}) } 'GITALIST_REPO_DIR env variable works';
+    lives_ok { Gitalist::Model::CollectionOfRepos->COMPONENT($ctx_gen->(), {}) } 'GITALIST_REPO_DIR env variable works';
 }
 
 {
@@ -104,7 +104,7 @@ sub test_with_config {
     my $ctx = $ctx_gen->();
         
     my $m;
-    lives_ok { $m = Gitalist::Model::GitRepos->COMPONENT($ctx, $config) } $msg;
+    lives_ok { $m = Gitalist::Model::CollectionOfRepos->COMPONENT($ctx, $config) } $msg;
     ok $m, 'Has model';
     my $i = $m->ACCEPT_CONTEXT($ctx);
     ok $i, 'Has model instance from ACCEPT_CONTEXT';