いけむランド

はてダからやってきました

Ruby Twitter Gem

cygwin から使用する場合も Greenbear Laboratory - Ruby Twitter Gem簡易リファレンス に書いてあるとおりにすれば、問題ないはず。


まず、rubygemsCygwin Ports から入手する。

rubygems をインストールしたら、続いて gems で twitter をインストールする。hpricot のヴァージョンについてはよくわからなかったため、とりあえず 0.6 の ruby を選んでみた。*1

% gem install twitter -y
Bulk updating Gem source index for: http://gems.rubyforge.org
Select which gem to install for your platform (i386-cygwin)
 1. hpricot 0.6 (mswin32)
 2. hpricot 0.6 (jruby)
 3. hpricot 0.6 (ruby)
 4. hpricot 0.5 (ruby)
 5. hpricot 0.5 (mswin32)
 6. Skip this gem
 7. Cancel installation
> 3
Building native extensions.  This could take a while...
Successfully installed twitter-0.2.3-
Successfully installed hpricot-0.6
Successfully installed activesupport-2.0.2
Successfully installed hoe-1.5.1
Successfully installed rubyforge-0.4.5
Successfully installed rake-0.8.1
Installing ri documentation for twitter-0.2.3-...
Installing ri documentation for hpricot-0.6...
Installing ri documentation for activesupport-2.0.2...
Installing ri documentation for hoe-1.5.1...
Installing ri documentation for rubyforge-0.4.5...
Installing ri documentation for rake-0.8.1...
Installing RDoc documentation for twitter-0.2.3-...
Installing RDoc documentation for hpricot-0.6...
Installing RDoc documentation for activesupport-2.0.2...
Installing RDoc documentation for hoe-1.5.1...
Installing RDoc documentation for rubyforge-0.4.5...
Installing RDoc documentation for rake-0.8.1...


さっそく twitter コマンドで送信を試みる。

% twitter post "test from twitter gem"
/usr/lib/ruby/gems/1.8/gems/twitter-0.2.3-/lib/twitter/command.rb:240:in `create_or_find_config': undefined method `[]' for false:FalseClass (NoMethodError)
        from /usr/lib/ruby/gems/1.8/gems/twitter-0.2.3-/lib/twitter/command.rb:39:in `post'
        from /usr/lib/ruby/gems/1.8/gems/twitter-0.2.3-/lib/twitter/command.rb:24:in `send'
        from /usr/lib/ruby/gems/1.8/gems/twitter-0.2.3-/lib/twitter/command.rb:24:in `process!'
        from /usr/lib/ruby/gems/1.8/gems/twitter-0.2.3-/bin/
        from /usr/bin/:in `load'
        from /usr/bin/


失敗した。...そういや、id とパスワードを設定していなかった。~/.twitter にそれらを書いておく。

# .twitter
# 
# Please fill in fields like this:
#
#  email: bla@bla.com
#  password: secret
#
email: twitter に登録しているメールアドレス
password: パスワード


再挑戦する。

% twitter post "test from twitter gem"

Sending twitter update.. OK!
Got it! New twitter created at: Sun Mar 23 02:30:26 +0000 2008


今度は成功した。送信できていることも確認した。

*1:mswin32 と jruby はなんか違う気がしたから。

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy