Make the version number sane and clean up copyright/license statements everywhere
[catagits/Gitalist.git] / lib / Gitalist / Controller / Root.pm
index cd09a42..b6ae871 100644 (file)
@@ -10,6 +10,7 @@ use Sys::Hostname ();
 use XML::Atom::Feed;
 use XML::Atom::Entry;
 use XML::RSS;
+use XML::OPML::SimpleGen;
 
 =head1 NAME
 
@@ -536,6 +537,29 @@ sub rss : Local {
   $c->response->status(200);
 }
 
+sub opml : Local {
+  my($self, $c) = @_;
+
+  my $opml = XML::OPML::SimpleGen->new();
+
+  $opml->head(title => lc(Sys::Hostname::hostname()) . ' - ' . Gitalist->config->{name});
+
+  my @list = @{ $c->model()->projects };
+  die 'No projects found in '. $c->model->repo_dir
+    unless @list;
+
+  for my $proj ( @list ) {
+    $opml->insert_outline(
+      text   => $proj->name. ' - '. $proj->description,
+      xmlUrl => $c->uri_for(rss => {p => $proj->name}),
+    );
+  }
+
+  $c->response->body($opml->as_string);
+  $c->response->content_type('application/rss');
+  $c->response->status(200);
+}
+
 =head2 patch
 
 A raw patch for a given commit.
@@ -626,11 +650,6 @@ sub auto : Private {
   );
 }
 
-sub opml : Local {
-    # FIXME - implement snapshot
-    Carp::croak "Not implemented.";
-}
-
 =head2 end
 
 Attempt to render a view, if needed.
@@ -692,16 +711,17 @@ sub age_string {
   return $age_str;
 }
 
+__PACKAGE__->meta->make_immutable;
+
+__END__
+
 
-=head1 AUTHOR
+=head1 AUTHORS
 
-Dan Brook
+See L<Gitalist> for authors.
 
 =head1 LICENSE
 
-This library is free software. You can redistribute it and/or modify
-it under the same terms as Perl itself.
+See L<Gitalist> for the license.
 
 =cut
-
-__PACKAGE__->meta->make_immutable;