Я пытаюсь начать работу с 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 Iнужно указать:
RAILS_GEM_VERSION = '1.2.3' unless defined? RAILS_GEM_VERSION
если я использую свою последнюю версию рельсов:
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
И это все :-)
Спасибо!