* Root /search page doesn't do anything
* Atom feed sucks shit (see t/atom.t)
+* OPML Feed dates incorrect format
* Sort out commitdiff so conflicted merges have an equivalent display to gitweb (d7f39bebabeb31ce9a7b4f1b6f3db9f391b78c3e as a reference)
* Need to sanitise the input ...
* The snapshot action does not properly support tgz - requests for this format will receive a tar. tbz2 is not supported at all (yet).
requires 'Sys::Hostname';
requires 'XML::Atom';
requires 'XML::RSS';
-requires 'XML::OPML::SimpleGen';
test_requires 'Test::More' => '0.88';
test_requires 'Test::utf8' => '0.02';
use Moose;
use Moose::Autobox;
-
+use DateTime;
use Sys::Hostname qw/hostname/;
use XML::OPML::SimpleGen;
my $opml = XML::OPML::SimpleGen->new();
- $opml->head(title => lc(hostname()) . ' - ' . blessed($c)->config->{name});
-
- for my $repos ( $c->model()->repositories->flatten ) {
- $opml->insert_outline(
- text => $repos->name. ' - '. $repos->description,
- xmlUrl => $c->uri_for_action('/repository/rss', [$repos->name])->as_string,
- );
- }
+ $c->stash(
+ title => lc(hostname()) . ' - ' . blessed($c)->config->{name},
+ Repositories => $c->model()->repositories,
+ now => DateTime->now,
+ template => 'opml.tt2',
+ no_wrapper => 1,
+ );
- $c->response->body($opml->as_string);
$c->response->content_type('application/rss');
}
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<opml version="1.1">
+ <body>[% count = 1 %]
+ [% FOR Repository = Repositories %]
+ <outline id="[% count %]"
+ description=""
+ text="[% Repository.name %] - [% Repository.description %]"
+ title=""
+ type="rss"
+ version="RSS"
+ xmlUrl="[% c.uri_for_action('/repository/rss', [ Repository.name ])%]" />
+ [% SET count = count + 1; END %]
+ </body>
+ <head>
+ <dateCreated>[% now %]</dateCreated>
+ <dateModified>[% now %]</dateModified>
+ <title>[% title %]</title>
+ </head>
+</opml>
my $res = request('/opml');
ok $res->is_success;
+is $res->content_type, 'application/rss';
like $res->content, qr{Gitalist</title>};
like $res->content, qr{xmlUrl="http://localhost/bare.git/rss"};
like $res->content, qr{text="repo1 - some test repository"};