[Bps-public-commit] r14428 - in Prophet/trunk: .

sartak at bestpractical.com sartak at bestpractical.com
Wed Jul 23 05:42:55 EDT 2008


Author: sartak
Date: Wed Jul 23 05:42:53 2008
New Revision: 14428

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/Makefile.PL
   Prophet/trunk/lib/Prophet/Server/View.pm

Log:
 r64865 at onn:  sartak | 2008-07-23 05:42:44 -0400
 Begin adding an Atom feed generator.. stuck on a few details


Modified: Prophet/trunk/Makefile.PL
==============================================================================
--- Prophet/trunk/Makefile.PL	(original)
+++ Prophet/trunk/Makefile.PL	Wed Jul 23 05:42:53 2008
@@ -26,6 +26,7 @@
 requires('Moose' => '0.54'); # Moose::Util::TypeConstraints Moose::Role
 requires('MooseX::AttributeHelpers' => '0.12');
 requires('MooseX::ClassAttribute' => '0.04');
+requires('XML::Atom::SimpleFeed');
 
 features(
     'Web server' => [
@@ -41,7 +42,6 @@
         'Template::Declare', # Template::Declare::Tags
     ],
 
-
     'Subversion replica support' => [
         -default => 0,
          'SVN::Core' # SVN::Repos SVN::Fs SVN::Ra SVN::Delta::Editor SVN::Client SVN::Delta

Modified: Prophet/trunk/lib/Prophet/Server/View.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Server/View.pm	(original)
+++ Prophet/trunk/lib/Prophet/Server/View.pm	Wed Jul 23 05:42:53 2008
@@ -4,6 +4,7 @@
 use warnings;
 use base 'Template::Declare';
 use Template::Declare::Tags;
+use Params::Validate;
 
 template '/' => sub {
     html {
@@ -98,5 +99,43 @@
     }
 };
 
+sub generate_changeset_feed {
+    my $self = shift;
+    my %args = validate(@_, {
+        handle => 1,
+        title  => 0,
+    });
+
+    my $handle = $args{handle};
+    my $title = $args{title} || 'Prophet replica ' . $handle->uuid;
+
+    require XML::Atom::SimpleFeed;
+
+    my $feed = XML::Atom::SimpleFeed->new(
+        id     => "urn:uuid:" . $handle->uuid,
+        title  => $title,
+        author => $ENV{USER},
+    );
+
+    my $newest = $handle->latest_sequence_no;
+    my $start = $newest - 20;
+    $start = 0 if $start < 0;
+
+    $handle->traverse_changesets(
+        after    => $start,
+        callback => sub {
+            my $change = shift;
+
+            $feed->add_entry(
+                title => 'Changeset ' . $change->sequence_no,
+                # need uuid or absolute link :(
+                category => 'Changeset',
+            );
+        },
+    );
+
+    return $feed;
+}
+
 1;
 



More information about the Bps-public-commit mailing list