aboutsummaryrefslogtreecommitdiff
path: root/atom.rb
diff options
context:
space:
mode:
authorBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2009-11-19 19:22:33 +0100
committerBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2009-11-19 19:22:33 +0100
commitb71b68e55f6550345dec2dc06994399150d8f9fc (patch)
tree3b7704a9e5e126f42f594d867e1ee3c8d8f47910 /atom.rb
parent9c53d2731d642a468781b1bd31ad676a2b4ecd11 (diff)
atom_single -> atom
Diffstat (limited to 'atom.rb')
-rwxr-xr-xatom.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/atom.rb b/atom.rb
new file mode 100755
index 0000000..b07faa1
--- /dev/null
+++ b/atom.rb
@@ -0,0 +1,44 @@
+#!/usr/bin/env ruby
+
+################################
+# Author: Benjamin Kellermann #
+# License: CC-by-sa 3.0 #
+# see License #
+################################
+
+require "rubygems"
+require "atom"
+require "yaml"
+require "cgi"
+require "time"
+
+$cgi = CGI.new
+
+
+feed = Atom::Feed.new
+olddir = File.expand_path(".")
+Dir.chdir("..")
+load "config.rb"
+require "poll"
+Dir.chdir(olddir)
+
+poll = YAML::load_file("data.yaml")
+
+feed.title = poll.name
+feed.id = "urn:dudle:#{poll.class}:#{poll.name}"
+feed.updated = File.new("data.yaml").mtime
+feed.authors << Atom::Person.new(:name => 'dudle automatic notificator')
+feed.links << Atom::Link.new(:href => SITEURL + "atom.cgi", :rel => "self")
+
+log = VCS.longhistory "."
+log.each {|rev,time,comment|
+ feed.entries << Atom::Entry.new do |e|
+ e.title = comment
+ e.links << Atom::Link.new(:href => "#{SITEURL}?revision=#{rev}")
+ e.id = "urn:#{poll.class}:#{poll.name}:rev=#{rev}"
+ e.updated = time
+ end
+}
+
+
+$cgi.out("type" => "application/atom+xml"){ feed.to_xml }