rubygem Twitter4R问题

我试图开始使用twitter4r,但我遇到了一些问题:

为什么我不能在IRB中加载宝石?

$ sudo gem install twitter4r
Successfully installed twitter4r-0.3.2
1 gem installed
Installing ri documentation for twitter4r-0.3.2...
Installing RDoc documentation for twitter4r-0.3.2...

$ irb
>> require 'rubygems'
=> false
>> require 'twitter4r'
LoadError: no such file to load -- twitter4r
       from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
       from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`require'
       from (irb):2

我已经下载了http://files.rubyforge.vm.bytemark.co.uk/twitter4r/twitter4rails.post-0_2_4.zip应用程序,它仅适用于twitter4r-0.2.4,不适用于最新版本twitter4r-0.3。 2:

$ script/server
./script/../config/boot.rb:26:Warning: Gem::SourceIndex#search support
for String patterns is deprecated, use #find_name
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
Exiting
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`gem_original_require': no such file to load -- twitter/rails
(MissingSourceFile)
       from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`require'
       from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/
dependencies.rb:495:in `require'
       from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/
dependencies.rb:342:in `new_constants_in'
       from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/
dependencies.rb:495:in `require'
       from /Users/leonardodarioperna/Projects/Kaaaki/marrakaaaki/
twitter4rails.post-0_2_4/config/environment.rb:64
       from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
       from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`require'
       from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/
dependencies.rb:495:in `require'
        ... 23 levels...
       from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39
       from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
       from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`require'
       from script/server:3

最后一件事,在/config/environment.rb我需要指定:

         RAILS_GEM_VERSION = '1.2.3' unless defined? RAILS_GEM_VERSION  

如果我使用我最后的rails版本:

        RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION 

我得到这个错误:

$ script/server -p3002
=> Booting Mongrel
=> Rails 2.3.4 application starting on http://0.0.0.0:3000
/Library/Ruby/Site/1.8/rubygems.rb:280:in `activate': can't activate
activerecord (= 1.15.6, runtime) for [], already activated
activerecord-2.3.4 for ["rails-2.3.4"] (Gem::LoadError)
       from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:35:in
`require'
       from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/
active_support/dependencies.rb:156:in `require'
       from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/
active_support/dependencies.rb:521:in `new_constants_in'
       from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/
active_support/dependencies.rb:156:in `require'
       from /Library/Ruby/Gems/1.8/gems/twitter4r-0.2.4/lib/twitter/rails.rb:
6
       from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
       from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`require'
       from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/
active_support/dependencies.rb:156:in `require'
        ... 8 levels...
       from /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/commands/server.rb:
84
       from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
       from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`require'
       from script/server:3
 

就这样 :-)

谢谢!


混淆的宝石名称和要求名称是不同的。 以下在irb中正常工作:

require 'twitter'
链接地址: http://www.djcxy.com/p/38745.html

上一篇: rubygem Twitter4R Issues

下一篇: Rake Test is failing