use XML::Atom::Feed;
use XML::Atom::Entry;
use XML::RSS;
+use XML::OPML::SimpleGen;
=head1 NAME
# XXX This could definitely use more context.
|| Carp::croak("Couldn't find a hash for the commit object!");
- my $commit = $m->get_object($hash)
- or Carp::croak("Couldn't find a commit object for '$hash' in '$pd'!");
+ my $obj = $m->get_object($hash)
+ or Carp::croak("Couldn't find a object for '$hash' in '$pd'!");
- return $commit;
+ return $obj;
}
=head2 index
my ( $self, $c ) = @_;
my $project = $c->stash->{Project};
- my $commit = $self->_get_object($c);
+ my $commit = $self->_get_object($c, $c->req->param('hb'));
my $filename = $c->req->param('f') || '';
my %logargs = (
# For legacy support.
sub history : Local {
- $_[0]->shortlog(@_[1 .. $#_]);
+ $_[1]->forward('shortlog');
}
=head2 tree
my ( $self, $c ) = @_;
my $project = $c->stash->{Project};
my $commit = $self->_get_object($c, $c->req->param('hb'));
- my $tree = $self->_get_object($c, $c->req->param('h') || $commit->tree_sha1);
+ my $filename = $c->req->param('f') || '';
+ my $tree = $filename
+ ? $project->get_object($project->hash_by_path($commit->sha1, $filename))
+ : $project->get_object($commit->tree_sha1)
+ ;
$c->stash(
commit => $commit,
tree => $tree,
$c->response->status(200);
}
+sub opml : Local {
+ my($self, $c) = @_;
+
+ my $opml = XML::OPML::SimpleGen->new();
+
+ $opml->head(title => lc(Sys::Hostname::hostname()) . ' - ' . Gitalist->config->{name});
+
+ my @list = @{ $c->model()->projects };
+ die 'No projects found in '. $c->model->repo_dir
+ unless @list;
+
+ for my $proj ( @list ) {
+ $opml->insert_outline(
+ text => $proj->name. ' - '. $proj->description,
+ xmlUrl => $c->uri_for(rss => {p => $proj->name}),
+ );
+ }
+
+ $c->response->body($opml->as_string);
+ $c->response->content_type('application/rss');
+ $c->response->status(200);
+}
+
=head2 patch
A raw patch for a given commit.
);
}
-sub opml : Local {
- # FIXME - implement snapshot
- Carp::croak "Not implemented.";
-}
-
=head2 end
Attempt to render a view, if needed.
return $age_str;
}
+__PACKAGE__->meta->make_immutable;
+
+__END__
-=head1 AUTHOR
-Dan Brook
+=head1 AUTHORS
+
+See L<Gitalist> for authors.
=head1 LICENSE
-This library is free software. You can redistribute it and/or modify
-it under the same terms as Perl itself.
+See L<Gitalist> for the license.
=cut
-
-__PACKAGE__->meta->make_immutable;