ece56f3ba221619197fab50ff5680259e566e091
[catagits/Gitalist.git] / lib / Gitalist / Controller / OPML.pm
1 package Gitalist::Controller::OPML;
2
3 use Moose;
4 use Moose::Autobox;
5 use DateTime;
6 use Sys::Hostname qw/hostname/;
7 use XML::OPML::SimpleGen;
8
9 use namespace::autoclean;
10
11 BEGIN { extends 'Gitalist::Controller' }
12
13 sub opml : Chained('/base') Args(0) {
14     my ($self, $c) = @_;
15
16     my $opml = XML::OPML::SimpleGen->new();
17
18     $c->stash(
19         title => lc(hostname()) . ' - ' . blessed($c)->config->{name},
20         Repositories => $c->model()->repositories,
21         now => DateTime->now,
22         template => 'opml.tt2',
23         no_wrapper => 1,
24     );
25
26     $c->response->content_type('application/rss');
27 }
28
29 __PACKAGE__->meta->make_immutable;