In my last post where I introduced my plan to produce a simple RSS based project dashboard I mentioned a few things which I thought would work but needed investigation. Top of my list is WEBrick and the potential to use it as a HTTP server for the generated RSS feeds.
So I did some googling and came across Gnome's Guide to Webrick which seemsed as good a place to start as any... It turned out better than that. Within four pages I had an example which I could use for the HTTP server element. The code goes like this:
What's next?; Well, I've had some more thoughts on the ins and outs of this and realised I need to think about packaging. I know I can package and distribute the app with the JRuby jar. This will mean all you'll need to do to get things up and running will be a .bat/.sh script with something like:
I also had a think about a logo for the project at the weekend. I think I might change the name after looking at Why's project page; need to learn the Gimp first though. More on that when I have something to actually display...
Oh, one final thing; this project seems to be vaguely in line with Eric Gamma - I heard on the Java Posse (episode #110) about his Project Jazz. Apparently he says a software dev. team should be like a village. Anyone want a local paper? ;-)
UPDATE: I'm aware WEBrick is not meant for production, (you should use something like Mongrel) but for the moment WEBrick seems just fine.
So I did some googling and came across Gnome's Guide to Webrick which seemsed as good a place to start as any... It turned out better than that. Within four pages I had an example which I could use for the HTTP server element. The code goes like this:
# Apologies to Gnome for knicking this lock-stock.Why so simple? Well, it turns out that WEBrick is bundled with Ruby (think of the java.util packages for example) so it's all just there. Also, what this piece needs to do isn't rocket science - just listen on a port and serve up the RSS files; requested by the dasboard.
require 'webrick'
include WEBrick # lets import the namespace so that we
# don't need to keep typing ::WEBrick
def start_webrick( config = {} )
# always listen on port 8080
config.update( :Port => 8080 )
server = HTTPServer.new( config )
# trap signals to invoke the shutdown procedure cleanly
yield server if block_given?
['INT', 'TERM'].each { |signal|
trap(signal){ server.shutdown }
}
server.start
end
start_webrick(:DocumentRoot => './../www/gen/rss')
What's next?; Well, I've had some more thoughts on the ins and outs of this and realised I need to think about packaging. I know I can package and distribute the app with the JRuby jar. This will mean all you'll need to do to get things up and running will be a .bat/.sh script with something like:
java -jar jruby.jar actadiurna_server.rbSimplicity itself. Might get more complex when I require external gems. I need to find out about packaging them I think...
I also had a think about a logo for the project at the weekend. I think I might change the name after looking at Why's project page; need to learn the Gimp first though. More on that when I have something to actually display...
Oh, one final thing; this project seems to be vaguely in line with Eric Gamma - I heard on the Java Posse (episode #110) about his Project Jazz. Apparently he says a software dev. team should be like a village. Anyone want a local paper? ;-)
UPDATE: I'm aware WEBrick is not meant for production, (you should use something like Mongrel) but for the moment WEBrick seems just fine.
No comments:
Post a Comment