Skip to content

Instantly share code, notes, and snippets.

@mattn
Created March 19, 2014 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/9641629 to your computer and use it in GitHub Desktop.
Save mattn/9641629 to your computer and use it in GitHub Desktop.
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