version 1.7, 2005/10/17 19:50:57
|
version 1.8, 2005/10/24 21:38:14
|
Line 49 my $rss = new XML::RSS(version => '2.0')
|
Line 49 my $rss = new XML::RSS(version => '2.0')
|
|
|
# If rssFeed exists, parse it |
# If rssFeed exists, parse it |
if (-r "$rssFeed") { |
if (-r "$rssFeed") { |
$rss->parsefile($rssFeed); |
$rss->parsefile($rssFeed); |
} |
} |
|
|
$rss->channel( |
$rss->channel( |
title=> $channelTitle, |
title=> $channelTitle, |
link => $channelLink, |
link => $channelLink, |
language => 'en', |
language => 'en', |
description => $channelTitle, |
description => $channelTitle, |
copyright => '(c) 2005 MSU Board of Trustees.', |
copyright => '(c) 2005 MSU Board of Trustees.', |
pubDate => $pubDate |
pubDate => $pubDate |
); |
); |
|
|
|
|
# Limit entries in the feed to $numEntries |
# Limit entries in the feed to $numEntries |
Line 71 $title[0] =~s/ /\//;
|
Line 71 $title[0] =~s/ /\//;
|
|
|
# Format the cvslog msg itself |
# Format the cvslog msg itself |
while (<STDIN>) { |
while (<STDIN>) { |
chomp($_); |
chomp($_); |
if ($_=~/^[A-Z].*:\s*$/) { |
if ($_=~/^[A-Z].*:\s*$/) { |
$_ = "<br /><b>" . &HTML::Entities::encode($_,'<>&"') . "</b><br />"; |
$_ = "<br /><b>" . &HTML::Entities::encode($_,'<>&"') . "</b><br />"; |
} |
} else { |
else { |
$_ = &HTML::Entities::encode($_,'<>&"'); |
$_ = &HTML::Entities::encode($_,'<>&"'); |
$_ .= "<br />"; |
$_ .= "<br />"; |
} |
} |
$description .= $_; |
$description .= $_; |
|
} |
} |
|
|
if ($cvsDiff == 1) { |
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 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. |
if (($title[1] != "NONE") && ($title[0]=~/(.*).(pm)$/)){ |
# This will rdiff it against the previous version, and |
my $tmpFile = "/tmp/diff.$$"; |
# include that diff in the rss feed |
my $cmdLine = "cvs -n rdiff -u -kk -r " . $title[1] . " -r " . $title[2] . " " . $title[0] . ">" . $tmpFile; |
|
system($cmdLine); |
if (($title[1] != "NONE") && ($title[0]=~/(.*).(pm|pl|conf|tab)$/)){ |
|
my $tmpFile = "/tmp/diff.$$"; |
$description .= "<br /><b>Differences:</b><br /><pre>"; |
my $cmdLine = "cvs -n rdiff -u -kk -r " . $title[1] . " -r " . $title[2] . " " . $title[0] . ">" . $tmpFile; |
open CVSDIFF, "<" . $tmpFile; |
system($cmdLine); |
foreach my $line (<CVSDIFF>) { |
|
$description .= &HTML::Entities::encode($line,'<>&"'); |
$description .= "<br /><b>Differences:</b><br /><pre>"; |
} |
open CVSDIFF, "<" . $tmpFile; |
$description .= "</pre>"; |
foreach my $line (<CVSDIFF>) { |
unlink($tmpFile); |
$description .= &HTML::Entities::encode($line,'<>&"'); |
} |
} |
|
$description .= "</pre>"; |
|
unlink($tmpFile); |
|
} |
} |
} |
|
|
$rss->add_item( |
$rss->add_item( |
title => "/" . $title[0] . " - " . $title[1] . "/" . $title[2], |
title => "/" . $title[0] . " - " . $title[1] . "/" . $title[2], |
author => $author, |
author => $author, |
description=> $description, |
description=> $description, |
mode => 'insert', |
mode => 'insert', |
pubDate => $pubDate, |
pubDate => $pubDate, |
link => 'http://install.loncapa.org/cgi-bin/cvsweb.cgi/'.$title[0].'.diff?r1='.$title[1].';r2='.$title[2].';f=h' |
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'}}) { |
foreach my $element (@{$rss->{'items'}}) { |
$element->{'description'} = &HTML::Entities::encode($element->{'description'},'<>&"'); |
$element->{'description'} = &HTML::Entities::encode($element->{'description'},'<>&"'); |
} |
} |
|
|
$rss->save($rssFeed); |
$rss->save($rssFeed); |