Twitter Client on Terminal with Streaming API.
It supports ruby 1.9 only.
- You can deal Twitter on Terminal entirely.
- You can receive data in real time with Streaming API.
- You can easily extend in Ruby.
gem install earthquake
$ earthquake
⚡ Hello World!
⚡ :recent
⚡ :recent twitter
⚡ :search #ruby
⚡ :eval Time.now
⚡ :exit
⚡ :reconnect
⚡ :restart
And there are more commands!
The config file is '~/.earthquake/config'.
Earthquake.config[:colors] = (31..36).to_a - [34]
The blue is excluded.
Earthquake.config[:debug] = true
デバッグモードで動作しているとき、コードの修正は即座に反映される(正確にはコマンドの実行の直前にリロードされる)。
"~/.earthquake/plugin" is the directory for plugins. At launch, Earthquake try to load files under the directory. プラグインの初期化処理は Earthquake.init のブロックの中で行うべきである。
Earthquake.init do
command :foo do
puts "foo!"
end
end
Earthquake.init do
command :hi do |m|
puts "Hi #{m[1]}!"
end
end
The 'm' is a MatchData.
Earthquake.init do
# Usage: :add 10 20
command %r|^:add (\d+)\s+(\d+)|, :as => :add do |m|
puts m[1].to_i + m[2].to_i
end
end
Earthquake.init do
output do |item|
next unless item["stream"]
if item["text"] =~ /ruby/i
notify "#{item["user"]["screen_name"]}: #{item["text"]}"
end
end
end
Earthquake.init do
output do |item|
case item["event"]
when "favorite"
notify "[favorite] #{item["source"]["screen_name"]} => #{item["target"]["screen_name"]} : #{item["target_object"]["text"]}"
end
end
end
Earthquake.init do
filter do |item|
if item["stream"] && item["text"]
item["text"] =~ /ruby/i
else
true
end
end
end
Earthquake.init do
completion do |text|
['@jugyo', 'earthquake', '#eqrb'].grep(/^#{Regexp.quote(text)}/)
end
end
- dealing direct messages
- more intelligent completion
- typable id
- spec
Copyright (c) 2011 jugyo. See LICENSE.txt for further details.