[LON-CAPA-cvs] cvs: CVSROOT / cvs2rss.pl

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 25 Oct 2005 14:09:49 -0000


albertel		Tue Oct 25 10:09:49 2005 EDT

  Modified files:              
    /CVSROOT	cvs2rss.pl 
  Log:
  - ugh, okay now I think I got the multi file commit correct
  
  
Index: CVSROOT/cvs2rss.pl
diff -u CVSROOT/cvs2rss.pl:1.10 CVSROOT/cvs2rss.pl:1.11
--- CVSROOT/cvs2rss.pl:1.10	Mon Oct 24 17:57:12 2005
+++ CVSROOT/cvs2rss.pl	Tue Oct 25 10:09:48 2005
@@ -29,6 +29,7 @@
 use POSIX;
 
 # Stuff you need to setup 
+my $cvslink = 'http://install.loncapa.org/cgi-bin/cvsweb.cgi/';
 my $rssFeed ="/home/loninst/public_html/loncapa.rss";
 my $emailDomain = "loncapa.org";
 my $channelTitle = "Lon-CAPA RSS Feed";
@@ -39,11 +40,12 @@
 my $cvsDiff = 1;
 
 # Leave everything else alone
-my $author = getpwuid(getuid()) . "\@" . $emailDomain;
-$author = 'guy' . "\@" . 'albertelli.com';
+my $author = getpwuid(getuid());
 my $pubDate = strftime('%a, %d %b %Y %H:%M:%S %Z',localtime(time));
 
 my @args = split(" ", $ARGV[0]);
+my $dir = shift(@args);
+
 # bail when this is a new directory
 &bail if $args[0] eq '-' && "$args[1] $args[2]" eq 'New directory';
 # bail if this is an import
@@ -81,6 +83,8 @@
     $commit_msg .= $_;
 }
 
+$commit_msg .= '<br /><b>Author:</b><br />'.$author.'<br />';
+
 foreach my $file (@args) {
     my @title=split(",",$file);
 
@@ -88,7 +92,8 @@
     # Format title of the rss item
     # Remove space, append / and set title to /file/that/changed - oldversion/newversion
     $title[0] =~s/ /\//;
-    
+    $title[0] = $dir.'/'.$title[0];
+
     # Format the cvslog msg itself
 
     if ($cvsDiff == 1) { 
@@ -113,7 +118,7 @@
 	}
     }
 
-    my $link = 'http://install.loncapa.org/cgi-bin/cvsweb.cgi/'.$title[0];
+    my $link = $cvslink.$title[0];
     if ($title[1] != "NONE") {
         $link .= '.diff?r1='.$title[1].';r2='.$title[2].';f=h';
     }
@@ -126,10 +131,11 @@
 		   pubDate => $pubDate,
 		   link => $link
 		   );		
+}
 
-    foreach my $element (@{$rss->{'items'}}) {
-	$element->{'description'} = &HTML::Entities::encode($element->{'description'},'<>&"'); 
-    }
+foreach my $element (@{$rss->{'items'}}) {
+    $element->{'description'} = 
+	&HTML::Entities::encode($element->{'description'},'<>&"');
 }
 
 $rss->save($rssFeed);