Curry Wiki

WelcomeToCurryWiki
ということでWikiもできました.翻訳はCurryを集中的にやる時間が現在それほど取れそうにないので,最初の簡単な前書きだけやった(後はJCUGメンバーに期待!).俺は基礎辺りを編集して行こうかなぁと.
http://twitter.com/CurryWikiJP
それとWikiの更新を知らせるBOTRubyで作った.某FreeBSDで5分間隔で更新してます.


周辺環境はこんなものかな?後は進むのみ.いつかCurry勉強会とかいう超マイナー勉強会でもやりたい.

追記

botのソース晒せやゴルァと言われた.昨日帰る直前に作ったので,ハードコーティングがいくつかあって微妙かも?マジックコメントとかあるけど,FreeBSDの1.9のgemがライブラリを読み込んでくれないので,1.8で動かしてるという.

#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

require 'rubygems'
require 'rubytter'
require 'time'
require 'rss/0.9'
require 'open-uri'

def exec_with_exit
  yield
rescue => e
  error(e)
  exit
end

def error(e)
  File.open('error.txt', 'a') { |f| f.puts "#{Time.now} : #{e}" }
end

# Gets RSS formatted 0.91
rss = exec_with_exit {
  open('http://ehl.jp/curry/?cmd=rss&ver=0.91') { |f| RSS::Parser.parse(f.read, false) }
}

log_name = '/path/to/latest.txt'  # Measure for cron
before   = Time.parse(File.open(log_name) { |f| f.read })  # before update time
updates  = []

# Selects new updates than before.
rss.items.each do |item|
  time = Time.parse(item.description)
  if time > before
    updates.unshift("Update: #{item.title}, #{item.link}, #{time.strftime('%Y/%m/%d(%a) - %H:%M:%S')}")
  end
end

exit if updates.empty?

# Posts new updates to Twitter
exec_with_exit {
  client = Rubytter.new('username', 'password')
  updates.each do |content|
    client.update(content)
    sleep 4
  end
}

# Saves the lastest update time for the future
File.open(log_name, 'w') { |f| f.print Time.parse(rss.items[0].description) }

Google groupの更新情報も配信すべきか迷っている.それだとアカウント名をJCUGとかにしないと駄目かも.