Created
March 19, 2014 13:29
-
-
Save mattn/9641629 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/Ukigumo/Server/Web/Dispatcher.pm b/lib/Ukigumo/Server/Web/Dispatcher.pm | |
index f417210..64b028f 100644 | |
--- a/lib/Ukigumo/Server/Web/Dispatcher.pm | |
+++ b/lib/Ukigumo/Server/Web/Dispatcher.pm | |
@@ -24,12 +24,14 @@ any '/' => sub { | |
push @{$projects{$project->{project}}}, $project; | |
} | |
- $c->render( 'index.tx', | |
+ my $res = $c->render( 'index.tx', | |
{ | |
now => time(), | |
projects => \%projects, | |
} | |
); | |
+ $res->content_type( 'application/xml' ); | |
+ $res; | |
}; | |
# CruiseControl format XML http://cruisecontrol.sourceforge.net/ | |
@@ -42,10 +44,30 @@ get '/cc.xml' => sub { | |
push @{$projects{$project->{project}}}, $project; | |
} | |
- $c->render( 'cc.xml.tx', | |
- { | |
- now => time(), | |
- projects => \%projects, | |
+ my $res = $c->render( 'cc.xml.tx', { | |
+ now => time(), | |
+ projects => \%projects, | |
+ }); | |
+ $res->content_type( 'application/xml' ); | |
+ $res; | |
+}; | |
+ | |
+get '/rss.xml' => sub { | |
+ my ($c, $args) = @_; | |
+ | |
+ my $limit = 50; | |
+ | |
+ my ($reports, $pager) = Ukigumo::Server::Command::Report->recent_list( | |
+ limit => $limit, | |
+ ); | |
+ for my $report (@{$reports}) { | |
+ $report->{body} = Ukigumo::Server::Command::Report->find( report_id => $report->{report_id} )->{body}; | |
+ } | |
+ use YAML::Syck; | |
+ return $c->render( | |
+ 'rss.xml.tx' => { | |
+ reports => $reports, | |
+ now => time(), | |
} | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment