Diff for /CVSROOT/cvs2rss.pl between versions 1.9 and 1.11

version 1.9, 2005/10/24 21:53:20 version 1.11, 2005/10/25 14:09:48
Line 29  use XML::RSS; Line 29  use XML::RSS;
 use POSIX;  use POSIX;
   
 # Stuff you need to setup   # Stuff you need to setup 
   my $cvslink = 'http://install.loncapa.org/cgi-bin/cvsweb.cgi/';
 my $rssFeed ="/home/loninst/public_html/loncapa.rss";  my $rssFeed ="/home/loninst/public_html/loncapa.rss";
 my $emailDomain = "loncapa.org";  my $emailDomain = "loncapa.org";
 my $channelTitle = "Lon-CAPA RSS Feed";  my $channelTitle = "Lon-CAPA RSS Feed";
Line 39  my $numEntries = 200; Line 40  my $numEntries = 200;
 my $cvsDiff = 1;  my $cvsDiff = 1;
   
 # Leave everything else alone  # Leave everything else alone
 my $author = getpwuid(getuid()) . "\@" . $emailDomain;  my $author = getpwuid(getuid());
 $author = 'guy' . "\@" . 'albertelli.com';  
 my $pubDate = strftime('%a, %d %b %Y %H:%M:%S %Z',localtime(time));  my $pubDate = strftime('%a, %d %b %Y %H:%M:%S %Z',localtime(time));
 my $description;  
   
   
 my @args = split(" ", $ARGV[0]);  my @args = split(" ", $ARGV[0]);
   my $dir = shift(@args);
   
 # bail when this is a new directory  # bail when this is a new directory
 &bail if $args[0] eq '-' && "$args[1] $args[2]" eq 'New directory';  &bail if $args[0] eq '-' && "$args[1] $args[2]" eq 'New directory';
 # bail if this is an import  # bail if this is an import
Line 71  $rss->channel( Line 71  $rss->channel(
 # Limit entries in the feed to $numEntries  # Limit entries in the feed to $numEntries
 pop(@{$rss->{'items'}}) while (@{$rss->{'items'}} >= $numEntries);  pop(@{$rss->{'items'}}) while (@{$rss->{'items'}} >= $numEntries);
   
   my $commit_msg;
   while (<STDIN>) {
       chomp($_);
       if ($_=~/^[A-Z].*:\s*$/) {
    $_ = "<br /><b>" . &HTML::Entities::encode($_,'<>&"') . "</b><br />";
       } else {
    $_ = &HTML::Entities::encode($_,'<>&"');
    $_ .= "<br />";
       }
       $commit_msg .= $_;
   }
   
   $commit_msg .= '<br /><b>Author:</b><br />'.$author.'<br />';
   
 foreach my $file (@args) {  foreach my $file (@args) {
     my @title=split(",",$file);      my @title=split(",",$file);
   
       my $description = $commit_msg;
     # Format title of the rss item      # Format title of the rss item
     # Remove space, append / and set title to /file/that/changed - oldversion/newversion      # Remove space, append / and set title to /file/that/changed - oldversion/newversion
     $title[0] =~s/ /\//;      $title[0] =~s/ /\//;
           $title[0] = $dir.'/'.$title[0];
   
     # Format the cvslog msg itself      # 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 .= $_;  
     }  
   
     if ($cvsDiff == 1) {       if ($cvsDiff == 1) { 
   
Line 113  foreach my $file (@args) { Line 118  foreach my $file (@args) {
  }   }
     }      }
   
     my $link = 'http://install.loncapa.org/cgi-bin/cvsweb.cgi/'.$title[0];      my $link = $cvslink.$title[0];
     if ($title[1] != "NONE") {      if ($title[1] != "NONE") {
         $link .= '.diff?r1='.$title[1].';r2='.$title[2].';f=h';          $link .= '.diff?r1='.$title[1].';r2='.$title[2].';f=h';
     }      }
Line 126  foreach my $file (@args) { Line 131  foreach my $file (@args) {
    pubDate => $pubDate,     pubDate => $pubDate,
    link => $link     link => $link
    );     );
   }
   
     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);

Removed from v.1.9  
changed lines
  Added in v.1.11


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>