From 55f337cb34ca305197bbc08e65399d2fb1029e2d Mon Sep 17 00:00:00 2001 From: BaronJenks Date: Tue, 23 Aug 2011 09:23:30 +0100 Subject: [PATCH] Generate feed dates in RFC2822 format --- ISSUES | 1 - Makefile.PL | 1 + lib/Gitalist/Controller/OPML.pm | 3 ++- lib/Gitalist/Controller/Repository.pm | 8 ++++---- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ISSUES b/ISSUES index 74d64a7..06e0837 100644 --- a/ISSUES +++ b/ISSUES @@ -1,6 +1,5 @@ * Root /search page doesn't do anything * Atom feed sucks shit (see t/atom.t) -* OPML & RSS & Atom Feed dates incorrect format * Gitweb compat URIs are borked - there were some I just wholesale ripped out. Put back.. * Sort out commitdiff so conflicted merges have an equivalent display to gitweb (d7f39bebabeb31ce9a7b4f1b6f3db9f391b78c3e as a reference) * Need to sanitise the input ... diff --git a/Makefile.PL b/Makefile.PL index 47d1db9..f376acd 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -91,6 +91,7 @@ requires 'Git::PurePerl' => '0.47'; requires 'aliased'; requires 'CGI'; requires 'DateTime'; +requires 'DateTime::Format::Mail'; requires 'File::Copy::Recursive'; requires 'File::Type'; requires 'File::Type::WebImages'; diff --git a/lib/Gitalist/Controller/OPML.pm b/lib/Gitalist/Controller/OPML.pm index 22aa032..65e66a0 100644 --- a/lib/Gitalist/Controller/OPML.pm +++ b/lib/Gitalist/Controller/OPML.pm @@ -3,6 +3,7 @@ package Gitalist::Controller::OPML; use Moose; use Moose::Autobox; use DateTime; +use DateTime::Format::Mail; use Sys::Hostname qw/hostname/; use namespace::autoclean; @@ -15,7 +16,7 @@ sub opml : Chained('/base') Args(0) { $c->stash( title => lc(hostname()) . ' - ' . blessed($c)->config->{name}, Repositories => $c->model()->repositories, - now => DateTime->now, + now => DateTime::Format::Mail->format_datetime( DateTime->now ), template => 'opml.tt2', no_wrapper => 1, ); diff --git a/lib/Gitalist/Controller/Repository.pm b/lib/Gitalist/Controller/Repository.pm index ec28dbb..f681bf3 100644 --- a/lib/Gitalist/Controller/Repository.pm +++ b/lib/Gitalist/Controller/Repository.pm @@ -1,8 +1,8 @@ package Gitalist::Controller::Repository; use Moose; use Sys::Hostname qw/hostname/; +use DateTime::Format::Mail; use namespace::autoclean; - BEGIN { extends 'Gitalist::Controller' } with 'Gitalist::URIStructure::Repository'; @@ -66,7 +66,7 @@ sub atom : Chained('find') Does('FilenameArgs') Args() { my $host = lc hostname(); $c->stash( title => $host . ' - ' . Gitalist->config->{name}, - updated => DateTime->now + updated => DateTime::Format::Mail->format_datetime( DateTime->now() ) ); my $repository = $c->stash->{Repository}; @@ -107,8 +107,8 @@ sub rss : Chained('find') Does('FilenameArgs') Args() { $c->stash( title => lc(Sys::Hostname::hostname()) . ' - ' . Gitalist->config->{name}, language => 'en', - pubDate => DateTime->now, - lastBuildDate => DateTime->now, + pubDate => DateTime::Format::Mail->format_datetime( DateTime->now() ), + lastBuildDate => DateTime::Format::Mail->format_datetime( DateTime->now() ), no_wrapper => 1, );