return %res;
}
+
=head2 end
Attempt to render a view, if needed.
=cut
sub end : ActionClass('RenderView') {
- # Give every view the current HEAD.
- $_[1]->stash->{HEAD} = $_[1]->model()->head_hash;
-
- # XXX Move this into a plugin!
- use DateTime::Format::Human::Duration;
- $_[1]->stash->{time_since} = sub {
- my($dt, $now) = ($_[0], DateTime->now);
-
- my($age) = $dt < (DateTime->now - DateTime::Duration->new(days=>12))
- ? $dt->ymd
- : DateTime::Format::Human::Duration->new->format_duration($now - $dt)
- =~ /^(?:.*?weeks?, )?(\d+ [^\d]+)(?:,|$) /;
-
-
- return $age;
- };
+ my ($self, $c) = @_;
+ # Give project views the current HEAD.
+ if ($c->stash->{project}) {
+ $c->stash->{HEAD} = $c->model()->head_hash;
+ }
+
+ # XXX Move this into a plugin!
+ use DateTime::Format::Human::Duration;
+ $c->stash->{time_since} = sub {
+ my($dt, $now) = ($self, DateTime->now);
+
+ my($age) = $dt < (DateTime->now - DateTime::Duration->new(days=>12))
+ ? $dt->ymd
+ : DateTime::Format::Human::Duration->new->format_duration($now - $dt)
+ =~ /^(?:.*?weeks?, )?(\d+ [^\d]+)(?:,|$) /;
+
+ return $age;
+ };
}
=head1 AUTHOR
method _build__util {
my $util = Gitalist::Git::Util->new(
- gitdir => $self->path,
+ gitdir => $self->project_dir($self->path),
);
return $util;
}
method _build_description {
- my $description = $self->path->file('description')->slurp;
- chomp $description;
+ my $description;
+ eval {
+ $description = $self->path->file('description')->slurp;
+ chomp $description;
+ };
+ $description ||= " ";
return $description;
}
use File::Which;
use Git::PurePerl;
use MooseX::Types::Common::String qw/NonEmptySimpleStr/;
- has gitdir => ( isa => "Path::Class::Dir", is => 'ro' );
+ has gitdir => ( isa => "Str", is => 'ro', required => 1 );
has _git => ( isa => NonEmptySimpleStr, is => 'ro', lazy_build => 1 );
sub _build__git {
my $git = File::Which::which('git');