From: Zachary Stevens Date: Thu, 12 Nov 2009 20:26:00 +0000 (+0000) Subject: Rename Object->contents to ->content, and delegate to GPP. X-Git-Tag: 0.000000_01~39 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=77b5d22c8523a52b3487d378b0b546e3414accf4;hp=fc11c7f105ef7e139f3bc7d0525896900fa033c9;p=catagits%2FGitalist.git Rename Object->contents to ->content, and delegate to GPP. --- diff --git a/lib/Gitalist/Controller/Root.pm b/lib/Gitalist/Controller/Root.pm index 8a23613..b066b80 100644 --- a/lib/Gitalist/Controller/Root.pm +++ b/lib/Gitalist/Controller/Root.pm @@ -172,7 +172,7 @@ sub blob : Local { my $filename = $c->req->param('f') || ''; $c->stash( - blob => $project->get_object($h)->contents, + blob => $project->get_object($h)->content, head => $project->get_object($hb), filename => $filename, # XXX Hack hack hack, see View::SyntaxHighlight diff --git a/lib/Gitalist/Git/Object.pm b/lib/Gitalist/Git/Object.pm index ff33b8d..3addbb6 100644 --- a/lib/Gitalist/Git/Object.pm +++ b/lib/Gitalist/Git/Object.pm @@ -40,14 +40,14 @@ class Gitalist::Git::Object { # This feels wrong, but current templates assume # these attributes are present on every object. - foreach my $key (qw/tree_sha1 comment/) { + foreach my $key (qw/tree_sha1 comment content/) { has $key => ( isa => Str, required => 1, is => 'ro', lazy_build => 1, ); method "_build_$key" { - return '' unless $self->_gpp_obj->can($key); + confess("Object can't " . $key) unless $self->_gpp_obj->can($key); return $self->_gpp_obj->$key; } } @@ -84,19 +84,4 @@ class Gitalist::Git::Object { $self->_run_cmd('cat-file', '-' . $flag, $self->{sha1}) } -=head2 contents - -Return the contents of a given file. - -=cut - - # FIXME - Should be an attribute so it gets cached? - method contents { - if ( $self->type ne 'blob' ) { - die "object $self->sha1 is not a file\n" - } - - $self->_cat_file_with_flag('p'); - } - } # end class