Rename Project to Repository in stash and templates.
Zachary Stevens [Sat, 19 Dec 2009 02:30:52 +0000 (02:30 +0000)]
14 files changed:
lib/Gitalist.pm
lib/Gitalist/Controller/Root.pm
lib/Gitalist/Git/CollectionOfRepositories/FromDirectory.pm
lib/Gitalist/Git/Repository.pm
root/_footer_feeds.tt2
root/_header_feeds.tt2
root/default.tt2
root/heads.tt2
root/index.tt2
root/nav/path.tt2
root/nav/search.tt2
root/summary.tt2
root/tags.tt2
t/02git_CollectionOfRepositories_FromDirectory.t

index 802e726..b5a3cca 100644 (file)
@@ -26,7 +26,7 @@ __PACKAGE__->setup();
 
 around uri_for => sub {
   my ($orig, $c) = (shift, shift);
-  my $project_name = $c->stash->{'Project'} && $c->stash->{'Project'}->name;
+  my $project_name = $c->stash->{'Repository'} && $c->stash->{'Repository'}->name;
   my $hash = ref($_[-1]) eq 'HASH' ? pop @_ : {};
   my $params = Catalyst::Utils::merge_hashes(
     { p => $hash->{p} || $project_name },
index b0a2bb9..98a5418 100644 (file)
@@ -24,7 +24,7 @@ sub _get_object {
   my $h = $haveh || $c->req->param('h') || '';
   my $f = $c->req->param('f');
 
-  my $m = $c->stash->{Project};
+  my $m = $c->stash->{Repository};
   my $pd = $m->path;
 
   # Either use the provided h(ash) parameter, the f(ile) parameter or just use HEAD.
@@ -88,7 +88,7 @@ A summary of what's happening in the repo.
 
 sub summary : Chained('base') Args(0) {
   my ( $self, $c ) = @_;
-  my $project = $c->stash->{Project};
+  my $project = $c->stash->{Repository};
   $c->detach('error_404') unless $project;
   my $commit = $self->_get_object($c);
   my @heads  = @{$project->heads};
@@ -113,7 +113,7 @@ The current list of heads (aka branches) in the repo.
 
 sub heads : Chained('base') Args(0) {
   my ( $self, $c ) = @_;
-  my $project = $c->stash->{Project};
+  my $project = $c->stash->{Repository};
   $c->stash(
     commit => $self->_get_object($c),
     heads  => $project->heads,
@@ -129,7 +129,7 @@ The current list of tags in the repo.
 
 sub tags : Chained('base') Args(0) {
   my ( $self, $c ) = @_;
-  my $project = $c->stash->{Project};
+  my $project = $c->stash->{Repository};
   $c->stash(
     commit => $self->_get_object($c),
     tags   => $project->tags,
@@ -140,7 +140,7 @@ sub tags : Chained('base') Args(0) {
 sub blame : Chained('base') Args(0) {
   my($self, $c) = @_;
 
-  my $project = $c->stash->{Project};
+  my $project = $c->stash->{Repository};
   my $h  = $c->req->param('h')
        || $project->hash_by_path($c->req->param('hb'), $c->req->param('f'))
        || die "No file or sha1 provided.";
@@ -166,7 +166,7 @@ sub blame : Chained('base') Args(0) {
 
 sub _blob_objs {
   my ( $self, $c ) = @_;
-  my $project = $c->stash->{Project};
+  my $project = $c->stash->{Repository};
   my $h  = $c->req->param('h')
        || $project->hash_by_path($c->req->param('hb'), $c->req->param('f'))
        || die "No file or sha1 provided.";
@@ -248,7 +248,7 @@ sub blobdiff : Chained('base') Args(0) {
   my $commit = $self->_get_object($c, $c->req->param('hb'));
   my $filename = $c->req->param('f')
               || croak("No file specified!");
-  my($tree, $patch) = $c->stash->{Project}->diff(
+  my($tree, $patch) = $c->stash->{Repository}->diff(
     commit => $commit,
     patch  => 1,
     parent => $c->req->param('hpb') || undef,
@@ -276,7 +276,7 @@ Exposes a given commit.
 
 sub commit : Chained('base') Args(0) {
   my ( $self, $c ) = @_;
-  my $project = $c->stash->{Project};
+  my $project = $c->stash->{Repository};
   my $commit = $self->_get_object($c);
   $c->stash(
       commit      => $commit,
@@ -295,7 +295,7 @@ Exposes a given diff of a commit.
 sub commitdiff : Chained('base') Args(0) {
   my ( $self, $c ) = @_;
   my $commit = $self->_get_object($c);
-  my($tree, $patch) = $c->stash->{Project}->diff(
+  my($tree, $patch) = $c->stash->{Repository}->diff(
       commit => $commit,
       parent => $c->req->param('hp') || undef,
       patch  => 1,
@@ -332,7 +332,7 @@ Expose an abbreviated log of a given sha1.
 sub shortlog : Chained('base') Args(0) {
   my ( $self, $c ) = @_;
 
-  my $project  = $c->stash->{Project};
+  my $project  = $c->stash->{Repository};
   my $commit   = $self->_get_object($c, $c->req->param('hb'));
   my $filename = $c->req->param('f') || '';
 
@@ -371,7 +371,7 @@ sub log : Chained('base') Args(0) {
 sub history : Chained('base') Args(0) {
     my ( $self, $c ) = @_;
     $self->shortlog($c);
-    my $project = $c->stash->{Project};
+    my $project = $c->stash->{Repository};
     my $file = $project->get_object(
         $project->hash_by_path(
             $project->head_hash,
@@ -391,7 +391,7 @@ The tree of a given commit.
 
 sub tree : Chained('base') Args(0) {
   my ( $self, $c ) = @_;
-  my $project = $c->stash->{Project};
+  my $project = $c->stash->{Repository};
   my $commit  = $self->_get_object($c, $c->req->param('hb'));
   my $filename = $c->req->param('f') || '';
   my $tree    = $filename
@@ -415,7 +415,7 @@ Expose the local reflog. This may go away.
 
 sub reflog : Chained('base') Args(0) {
   my ( $self, $c ) = @_;
-  my @log = $c->stash->{Project}->reflog(
+  my @log = $c->stash->{Repository}->reflog(
       '--since=yesterday'
   );
 
@@ -434,7 +434,7 @@ The action for the search form.
 sub search : Chained('base') Args(0) {
   my($self, $c) = @_;
   $c->stash(current_action => 'GitRepos');
-  my $project = $c->stash->{Project};
+  my $project = $c->stash->{Repository};
   my $commit  = $self->_get_object($c);
   # Lifted from /shortlog.
   my %logargs = (
@@ -482,7 +482,7 @@ sub atom : Chained('base') Args(0) {
   $feed->title($host . ' - ' . Gitalist->config->{name});
   $feed->updated(~~DateTime->now);
 
-  my $project = $c->stash->{Project};
+  my $project = $c->stash->{Repository};
   my %logargs = (
       sha1   => $project->head_hash,
       count  => Gitalist->config->{paging}{log} || 25,
@@ -513,7 +513,7 @@ Provides an RSS feed for a given project.
 sub rss : Chained('base') Args(0) {
   my ($self, $c) = @_;
 
-  my $project = $c->stash->{Project};
+  my $project = $c->stash->{Repository};
 
   my $rss = XML::RSS->new(version => '2.0');
   $rss->channel(
@@ -607,7 +607,7 @@ sub snapshot : Chained('base') Args(0) {
     my $format = $c->req->param('sf') || 'tgz';
     die unless $format;
     my $sha1 = $c->req->param('h') || $self->_get_object($c)->sha1;
-    my @snap = $c->stash->{Project}->snapshot(
+    my @snap = $c->stash->{Repository}->snapshot(
         sha1 => $sha1,
         format => $format
     );
@@ -624,14 +624,14 @@ sub base : Chained('/root') PathPart('') CaptureArgs(0) {
   my $project = $c->req->param('p');
   if (defined $project) {
     eval {
-      $c->stash(Project => $c->model('GitRepos')->get_project($project));
+      $c->stash(Repository => $c->model('GitRepos')->get_project($project));
     };
     if ($@) {
       $c->detach('/error_404');
     }
   }
 
-  my $a_project = $c->stash->{Project} || $c->model()->projects->[0];
+  my $a_project = $c->stash->{Repository} || $c->model()->projects->[0];
   $c->stash(
     git_version => $a_project->run_cmd('--version'),
     version     => $Gitalist::VERSION,
@@ -656,8 +656,8 @@ sub base : Chained('/root') PathPart('') CaptureArgs(0) {
 sub end : ActionClass('RenderView') {
     my ($self, $c) = @_;
     # Give project views the current HEAD.
-    if ($c->stash->{Project}) {
-        $c->stash->{HEAD} = $c->stash->{Project}->head_hash;
+    if ($c->stash->{Repository}) {
+        $c->stash->{HEAD} = $c->stash->{Repository}->head_hash;
     }
 }
 
index 69e475d..8eaf947 100644 (file)
@@ -55,10 +55,7 @@ Gitalist::Git::CollectionOfRepositories::FromDirectory - Model of a repository d
 
 =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
 
index f82a026..4aee01e 100644 (file)
@@ -347,14 +347,14 @@ Gitalist::Git::Repository - Model of a git repository
 =head1 DESCRIPTION
 
 This class models a git repository, referred to in Gitalist
-as a "Project".
+as a "Repository".
 
 
 =head1 ATTRIBUTES
 
 =head2 name
 
-The name of the Project.  If unspecified, this will be derived from the path to the git repository.
+The name of the Repository.  If unspecified, this will be derived from the path to the git repository.
 
 =head2 path
 
index 0e50cf8..0709866 100644 (file)
@@ -1,4 +1,4 @@
-  [% IF Project %]
+  [% IF Repository %]
     [%-
       has_branch = c.req.param('h').match('^(refs/heads/.*)') || c.req.param('hb').match('^(refs/heads/.*)');
       branch     = has_branch.0 || '';
index 5982b16..7db8f4a 100644 (file)
@@ -1,14 +1,14 @@
-  [% IF Project %]
+  [% IF Repository %]
   <!-- XXX Missing the no-merges links -->
   <link
     rel="alternate"
-    title="[% Project.name %] - [% title %] Atom feed"
+    title="[% Repository.name %] - [% title %] Atom feed"
     href="[% c.uri_for('atom') %]"
     type="application/atom+xml"
   >
   <link
     rel="alternate"
-    title="[% Project.name %] - [% title %] RSS feed"
+    title="[% Repository.name %] - [% title %] RSS feed"
     href="[% c.uri_for('rss') %]"
     type="application/rss+xml"
   >
index db90b2c..d38cdcb 100644 (file)
@@ -9,7 +9,7 @@
   <title>[%-
     title = BLOCK;
       c.config.sitename;
-      IF Project; ' - ' _ Project.name | html; END;
+      IF Repository; ' - ' _ Repository.name | html; END;
       IF action;  ' / ' _ action; END;
       IF filename; ' - ' _ filename | html; END;
       IF action && action == 'tree'; '/'; END;
    <img src="[% c.uri_for('/logo.png') %]" alt="git" class="logo">
   </a>
   <a href="[% c.uri_for('/', {p=''}) %]">A Gitalist</a>
-  [%- IF Project %]
-  / <a href="[% c.uri_for('summary') %]">[% Project.name %]</a>
+  [%- IF Repository %]
+  / <a href="[% c.uri_for('summary') %]">[% Repository.name %]</a>
   [% IF action;  " / " _ action; END;
   END %]
 [%
-  IF Project;
+  IF Repository;
     INCLUDE 'nav/search.tt2';
   END;
 # / git_header_html
@@ -62,8 +62,8 @@
 </div>
 
 <div id="page-footer">
-[% IF Project %]
-  [% Project.description | html %]
+[% IF Repository %]
+  [% Repository.description | html %]
 [% END %]
 [% INCLUDE '_footer_feeds.tt2' %]
 </div>
index 1c5e263..baa8e4b 100644 (file)
@@ -2,7 +2,7 @@
 
 <div class='content'>
   <div>
-  [% Project.name %]
+  [% Repository.name %]
   </div>
 
   [% INCLUDE '_heads.tt2' %]
index 428e932..f08809d 100644 (file)
@@ -8,7 +8,7 @@
   <table class="project_list">
     <thead>
        <tr>
-           <th>Project</th>
+           <th>Repository</th>
            <!-- XXX These do nothing presently -->
            <th><a class="header" href="/?o=descr">Description</a></th>
            <th><a class="header" href="/?o=owner">Owner</a></th>
@@ -18,7 +18,7 @@
     </thead>
     <tfoot>
        <tr>
-           <td>Project</td>
+           <td>Repository</td>
            <!-- XXX These do nothing presently -->
            <td><a href="/?o=descr">Description</a></td>
            <td><a href="/?o=owner">Owner</a></td>
index c6df728..eef339c 100644 (file)
@@ -1,5 +1,5 @@
 <div class='path'>
- <a href="[% c.uri_for("tree", {hb=head.sha1}) %]">[% Project.name %]</a>
+ <a href="[% c.uri_for("tree", {hb=head.sha1}) %]">[% Repository.name %]</a>
  [% FOREACH part IN filename.split('/') %]
   [% path = loop.first ? part : path _ '/' _ part %]
   / <a href="[% c.uri_for(loop.last ? 'blob' : 'tree', {hb=head.sha1,f=path}) %]">[% part %]</a>
index 330a17a..35c3d88 100644 (file)
@@ -1,6 +1,6 @@
 <div id="page-search">
   <form method="get" action="[% c.uri_for('search') %]" enctype="application/x-www-form-urlencoded">
-  <input name="p" type="hidden" value="[% Project.name %]">
+  <input name="p" type="hidden" value="[% Repository.name %]">
   <input name="a" type="hidden" value="search">
   <input name="h" type="hidden" value="[% commit.sha1 %]">
   <input name="f" type="hidden" value="[% c.req.param('f') %]">
index 06efaa9..be4b3e1 100644 (file)
@@ -9,9 +9,9 @@
  </div> -->
 
  <dl>
-  <dt>description</dt><dd>[% Project.description %]</dd>
-  <dt>owner</dt><dd>[% Project.owner %]</dd>
-  <dt>last change</dt><dd>[% Project.last_change %]</dd>
+  <dt>description</dt><dd>[% Repository.description %]</dd>
+  <dt>owner</dt><dd>[% Repository.owner %]</dd>
+  <dt>last change</dt><dd>[% Repository.last_change %]</dd>
  </dl>
 
   <h2><a href='[% c.uri_for("shortlog") %]'>shortlog</a></h2>
index f974bb9..6f47285 100644 (file)
@@ -1,7 +1,7 @@
 [% INCLUDE 'nav/actions.tt2' object = commit %]
 <div class='content'>
   <div>
-  [% Project.name %]
+  [% Repository.name %]
   </div>
 
   [% INCLUDE '_heads.tt2' heads = tags %]
index 5cea584..247ad25 100644 (file)
@@ -32,7 +32,7 @@ isa_ok($project_list->[0], 'Gitalist::Git::Repository');
 is($project_list->[0]->{name}, 'bare.git', 'list_projects has correct name for "bare.git" repo' );
 
 dies_ok {
-    my $project = $repo->get_project('NoSuchProject');
+    my $project = $repo->get_project('NoSuchRepository');
 } 'throws exception for invalid project';
 
 dies_ok {