From b71b68e55f6550345dec2dc06994399150d8f9fc Mon Sep 17 00:00:00 2001 From: Benjamin Kellermann Date: Thu, 19 Nov 2009 19:22:33 +0100 Subject: atom_single -> atom --- atom.rb | 44 ++++++++++++++++++++++++++++++++++++++++++++ atom_single.rb | 44 -------------------------------------------- index.cgi | 2 +- 3 files changed, 45 insertions(+), 45 deletions(-) create mode 100755 atom.rb delete mode 100755 atom_single.rb 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 } diff --git a/atom_single.rb b/atom_single.rb deleted file mode 100755 index b07faa1..0000000 --- a/atom_single.rb +++ /dev/null @@ -1,44 +0,0 @@ -#!/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 } diff --git a/index.cgi b/index.cgi index 6d8b982..ecd96a3 100755 --- a/index.cgi +++ b/index.cgi @@ -56,7 +56,7 @@ if $cgi.include?("create_poll") Dir.chdir(SITE) VCS.init File.symlink("../participate.rb","index.cgi") - File.symlink("../atom_single.rb","atom.cgi") + File.symlink("../atom.rb","atom.cgi") File.symlink("../config_poll.rb","config.cgi") File.symlink("../remove_poll.rb","remove.cgi") ["index.cgi","atom.cgi","config.cgi","remove.cgi"].each{|f| -- cgit v1.2.3