diff --git a/META.json b/META.json
index c326e4d..4e575c2 100644
--- a/META.json
+++ b/META.json
@@ -74,6 +74,7 @@
"Plack::Middleware::Session" : "0.14",
"Plack::Session::Store::File" : "0",
"Pod::Usage" : "0",
+ "POSIX::strftime::Compiler" : "0.31",
"Router::Simple" : "0.14",
"Router::Simple::Sinatraish" : "0",
"Starlet" : "0",
@@ -83,7 +84,6 @@
"Text::Xslate::Util" : "0",
"Time::Duration" : "0",
"Time::Duration::ja" : "0.03",
- "Time::Piece" : "1.20",
"URI::Escape" : "0",
"URI::WithBase" : "0",
"Ukigumo::Common" : "0.04",
diff --git a/cpanfile b/cpanfile
index 4070384..53857c3 100644
--- a/cpanfile
+++ b/cpanfile
@@ -3,7 +3,7 @@ requires 'Amon2' => '2.50';
requires 'Amon2::Plugin::ShareDir';
requires 'Text::Xslate' => '1.1005';
requires 'Plack::Middleware::ReverseProxy' => '0.09';
-requires 'Time::Piece' => '1.20';
+requires 'POSIX::strftime::Compiler' => '0.31';
requires 'DBI' => 0;
requires 'DBD::SQLite' => 1.33;
requires 'Data::Validator' => 0.08;
diff --git a/lib/Ukigumo/Server/Command/Branch.pm b/lib/Ukigumo/Server/Command/Branch.pm
index cbce8f0..1929c08 100644
--- a/lib/Ukigumo/Server/Command/Branch.pm
+++ b/lib/Ukigumo/Server/Command/Branch.pm
@@ -6,7 +6,6 @@ use 5.010001;
use Amon2::Declare;
use Data::Validator;
-use Time::Piece;
sub find_or_create {
my $class = shift;
diff --git a/lib/Ukigumo/Server/Web/Dispatcher.pm b/lib/Ukigumo/Server/Web/Dispatcher.pm
index f417210..a978aad 100644
--- a/lib/Ukigumo/Server/Web/Dispatcher.pm
+++ b/lib/Ukigumo/Server/Web/Dispatcher.pm
@@ -4,7 +4,6 @@ use warnings;
use 5.010001;
use Amon2::Web::Dispatcher::Lite;
use URI::Escape qw(uri_unescape uri_escape);
-use Time::Piece;
use Ukigumo::Server::Command::Report;
use Ukigumo::Server::Command::Branch;
use Data::Validator;
@@ -42,12 +41,36 @@ get '/cc.xml' => sub {
push @{$projects{$project->{project}}}, $project;
}
- $c->render( 'cc.xml.tx',
+ 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};
+ }
+ my $res = $c->render(
+ 'rss.xml.tx' => {
+ reports => $reports,
+ now => time(),
+ base_uri => $c->req->base,
+ }
+ );
+ $res->content_type( 'application/xml' );
+ $res;
};
get '/recent' => sub {
diff --git a/lib/Ukigumo/Server/Web/ViewFunctions.pm b/lib/Ukigumo/Server/Web/ViewFunctions.pm
index 23c9393..7b782d0 100644
--- a/lib/Ukigumo/Server/Web/ViewFunctions.pm
+++ b/lib/Ukigumo/Server/Web/ViewFunctions.pm
@@ -6,7 +6,7 @@ use parent qw(Exporter);
use URI::WithBase;
use Text::Xslate qw/mark_raw html_escape/;
use Module::Functions;
-use Time::Piece;
+use POSIX::strftime::Compiler qw/strftime/;
use Ukigumo::Constants;
our @EXPORT = get_public_functions();
@@ -36,7 +36,7 @@ sub l {
sub ctime_cc_str {
my $epoch = shift;
- Time::Piece->new($epoch)->strftime('%Y-%m-%dT%H:%M:%S.000%z');
+ strftime('%Y-%m-%dT%H:%M:%S.000%z', localtime $epoch);
}
sub status_cc_str {
diff --git a/share/static/css/rss.css b/share/static/css/rss.css
new file mode 100644
index 0000000..2569ce7
--- /dev/null
+++ b/share/static/css/rss.css
@@ -0,0 +1,32 @@
+rss {
+ display: block;
+ font-family: verdana, arial;
+}
+title {
+ display: block;
+ margin: 5px;
+ padding: 2px;
+ color: gray;
+ border-bottom: 1px solid silver;
+}
+link {
+ display: block;
+ font-size: small;
+ padding-left: 10px;
+}
+item {
+ display: block;
+ padding: 2px 30px 2px 30px;
+}
+docs {
+ display: block;
+ background-color: #ffffe6;
+ margin: 20px;
+ text-align: center;
+ padding: 5px;
+ color: #7f7f7f;
+ border: 1px solid silver;
+}
+language, lastBuildDate, ttl, guid, category, description, pubDate, generator, channel>link {
+ display: none;
+}
diff --git a/share/tmpl/include/layout.tx b/share/tmpl/include/layout.tx
index b90e91f..6d69297 100644
--- a/share/tmpl/include/layout.tx
+++ b/share/tmpl/include/layout.tx
@@ -8,6 +8,7 @@
+
diff --git a/share/tmpl/rss.xml.tx b/share/tmpl/rss.xml.tx
new file mode 100644
index 0000000..5a82c61
--- /dev/null
+++ b/share/tmpl/rss.xml.tx
@@ -0,0 +1,18 @@
+
+" ?>
+
+
+Recent reports
+<: abs_uri_for('/') :>
+Recent build statuses
+Ukigumo::Server
+: for $reports -> $v {
+-
+<: $v.project :>-<: $v.branch :> <: $v.revision :> <: $v.status | status_str :>
+<: abs_uri_for('/report/' ~ $v.report_id) :>
+<: $v.ctime | ctime_cc_str :>
+
<: $v.body :>
+
+: }
+
+