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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 24 Oct 2005 21:38:16 -0000


albertel		Mon Oct 24 17:38:16 2005 EDT

  Modified files:              
    /CVSROOT	cvs2rss.pl 
  Log:
  - retabinate
  
  
Index: CVSROOT/cvs2rss.pl
diff -u CVSROOT/cvs2rss.pl:1.7 CVSROOT/cvs2rss.pl:1.8
--- CVSROOT/cvs2rss.pl:1.7	Mon Oct 17 15:50:57 2005
+++ CVSROOT/cvs2rss.pl	Mon Oct 24 17:38:14 2005
@@ -49,17 +49,17 @@
 
 # If rssFeed exists, parse it
 if (-r "$rssFeed") {
-	$rss->parsefile($rssFeed);
+    $rss->parsefile($rssFeed);
 }
 
 $rss->channel(
-	title=> $channelTitle,
-	link => $channelLink,
-	language => 'en',
-	description => $channelTitle,
-	copyright => '(c) 2005 MSU Board of Trustees.',
-	pubDate => $pubDate 
-);
+	      title=> $channelTitle,
+	      link => $channelLink,
+	      language => 'en',
+	      description => $channelTitle,
+	      copyright => '(c) 2005 MSU Board of Trustees.',
+	      pubDate => $pubDate 
+	      );
 
 
 # Limit entries in the feed to $numEntries
@@ -71,47 +71,49 @@
 
 # Format the cvslog msg itself
 while (<STDIN>) {
-	chomp($_);
-	if ($_=~/^[A-Z].*:\s*$/) {
-		$_ = "<br /><b>" . &HTML::Entities::encode($_,'<>&"') . "</b><br />";
-	}
-	else {
-		$_ = &HTML::Entities::encode($_,'<>&"');
-		$_ .= "<br />";
-	}
-	$description .= $_;
+    chomp($_);
+    if ($_=~/^[A-Z].*:\s*$/) {
+	$_ = "<br /><b>" . &HTML::Entities::encode($_,'<>&"') . "</b><br />";
+    } else {
+	$_ = &HTML::Entities::encode($_,'<>&"');
+	$_ .= "<br />";
+    }
+    $description .= $_;
 }
 
-if ($cvsDiff == 1) {
-	# If the old version of the file is not NONE (if it isn't a new file), and if it is a .txt or .java file (that has no html)
-	# This will rdiff it against the previous version, and include that diff in the rss feed
-
-	if (($title[1] != "NONE") && ($title[0]=~/(.*).(pm)$/)){
-		my $tmpFile = "/tmp/diff.$$";
-		my $cmdLine = "cvs -n rdiff -u -kk -r " . $title[1] .  " -r " . $title[2] . " " . $title[0] . ">" . $tmpFile;
-		system($cmdLine);
-
-		$description .= "<br /><b>Differences:</b><br /><pre>";
-		open CVSDIFF, "<" . $tmpFile;
-		foreach my $line (<CVSDIFF>) {
-			$description .= &HTML::Entities::encode($line,'<>&"');
-		}
-		$description .= "</pre>";
-		unlink($tmpFile);   
-	} 
+if ($cvsDiff == 1) { 
+
+    # If the old version of the file is not NONE (if
+    # it isn't a new file), and if it is a pm/pl/conf/tab file.
+    # This will rdiff it against the previous version, and
+    # include that diff in the rss feed
+
+    if (($title[1] != "NONE") && ($title[0]=~/(.*).(pm|pl|conf|tab)$/)){
+	my $tmpFile = "/tmp/diff.$$";
+	my $cmdLine = "cvs -n rdiff -u -kk -r " . $title[1] .  " -r " . $title[2] . " " . $title[0] . ">" . $tmpFile;
+	system($cmdLine);
+	
+	$description .= "<br /><b>Differences:</b><br /><pre>";
+	open CVSDIFF, "<" . $tmpFile;
+	foreach my $line (<CVSDIFF>) {
+	    $description .= &HTML::Entities::encode($line,'<>&"');
+	}
+	$description .= "</pre>";
+	unlink($tmpFile);   
+    } 
 }
 
 $rss->add_item(
-	title => "/" . $title[0] . " - " . $title[1] . "/" . $title[2],
-	author => $author,
-	description=> $description,
-	mode => 'insert',
-	pubDate => $pubDate,
-	link => 'http://install.loncapa.org/cgi-bin/cvsweb.cgi/'.$title[0].'.diff?r1='.$title[1].';r2='.$title[2].';f=h'
-);		
+	       title => "/" . $title[0] . " - " . $title[1] . "/" . $title[2],
+	       author => $author,
+	       description=> $description,
+	       mode => 'insert',
+	       pubDate => $pubDate,
+	       link => 'http://install.loncapa.org/cgi-bin/cvsweb.cgi/'.$title[0].'.diff?r1='.$title[1].';r2='.$title[2].';f=h'
+	       );		
 
 foreach my $element (@{$rss->{'items'}}) {
-	$element->{'description'} = &HTML::Entities::encode($element->{'description'},'<>&"'); 
+    $element->{'description'} = &HTML::Entities::encode($element->{'description'},'<>&"'); 
 }
 
 $rss->save($rssFeed);