views:

63

answers:

1

From a Windows command line, I'd like to be able to publish to an RSS feed. I visualize something like this:

rsspub @builds "Build completed without errors."

Then, someone could go to my computer:

http://xp64-Matt:9090/builds/rss.xml

And there'd be a new entry with the date and time and the simple text "Build completed without errors."

I'd like the feed itself to run on a different port, so I'm not fighting with IIS or Apache, or whatever else I need to run on my computer on a day-to-day basis.

Does anything like this exist?

+3  A: 

Here's a simple .Net 3.5 C# program that will create an RSS XML file that you can store in your IIS webroot:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.IO;

namespace CommandLineRSS
{
    class Program
    {
     static void Main( string[] args )
     {
      var file = args[ 0 ];
      var newEntry = args[ 1 ];

      var xml = new XmlDocument();

      if ( File.Exists( file ) )
       xml.Load( file );
      else
       xml.LoadXml( @"<rss version='2.0'><channel /></rss>" );

      var xmlNewEntry = Create( (XmlElement)xml.SelectSingleNode( "/rss/channel" ), "item" );
      Create( xmlNewEntry, "title" ).InnerText = newEntry;
      Create( xmlNewEntry, "pubDate" ).InnerText = DateTime.Now.ToString("R");

      xml.Save( file );
     }

     private static XmlElement Create( XmlElement parent, string tag )
     {
      var a = parent.OwnerDocument.CreateElement( tag );
      parent.AppendChild( a );
      return a;
     }
    }
}

Then you can call it like this:

CommandLineRSS.exe c:\inetpub\wwwroot\builds.xml "Build completed with errors."
David