1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require 'rubygems'
require 'active_support'
require 'hpricot'
require 'open-uri'

doc = Hpricot(open("http://vote.railsrumble.com"))
apps = doc/"a[@href$=.vote.railsrumble.com]"
no_login = 0
no_openid = 0
openid = 0
apps.inject({}) do |mem, app| # !> `&' interpreted as argument prefix
  app_link = app.get_attribute 'href'
  match = app_link.match(/http:\/\/([\w-]+).vote/)
  next unless match
  app_name = match[1]
  url = "http://#{app_name}.railsrumble.com"
  login_url = "#{url}/login"
  sessions_new_url = "#{url}/sessions/new"
  contents = (open(login_url, "r") { |io| io.read } rescue "")
  contents += (open(url, "r") { |io| io.read } rescue "") # joglog has openid mentioned on home page
  contents += (open(sessions_new_url, "r") { |io| io.read } rescue "") # joglog has openid mentioned on home page
  if mem[app_name] = (contents =~ /open\s?id/i)
    puts "#{app_name} -> #{url}"
    openid += 1
  else
    puts "NO OPENID: #{app_name}"
    no_openid += 1
  end
  mem
end

puts "OpenID sites: #{openid}"
puts "No-OpenID sites: #{no_openid}"
puts "No login? sites: #{no_login}"