Using scrubyt with Ruby 1.9.2 on Windows, and get the following error when calling Scrubyt::Extractor.define do
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:479:in load_missing_constant': Scrubyt::Navigation is not missing constant Mechanize! (ArgumentError)
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:183:inblock in const_missing'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:181:in each'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:181:inconst_missing'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/scrubyt-0.4.31/lib/scrubyt/core/navigation/agents/mechanize.rb:17:in block in included'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/scrubyt-0.4.31/lib/scrubyt/core/navigation/agents/mechanize.rb:16:inmodule_eval'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/scrubyt-0.4.31/lib/scrubyt/core/navigation/agents/mechanize.rb:16:in included'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/scrubyt-0.4.31/lib/scrubyt/core/shared/extractor.rb:29:ininclude'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/scrubyt-0.4.31/lib/scrubyt/core/shared/extractor.rb:29:in block in define'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/scrubyt-0.4.31/lib/scrubyt/core/shared/extractor.rb:28:inclass_eval'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/scrubyt-0.4.31/lib/scrubyt/core/shared/extractor.rb:28:in `define'
It seems to be related to @@agent = Mechanize::Mechanize.new
in scrubyt/core/navigation/agents/mechanize.rb that Mechanize is not loaded despite that in the file "require 'mechanize'" is specified
I installed mechanize (2.0.1), hpricot (0.8.4), fireawtir (1.9.3) and nokogiri 开发者_运维百科(1.5.0)
Any ideas about why the issue?
Solved now by using mechanize (0.9.3) and changed scrubyt-0.4.31\lib\scrubyt\core\navigation\agents\mechanize.rb, @@agent = Mechanize::Mechanize.new to @@agent = WWW::Mechanize.new. Might just be a problem at my own, but post the solution here in case anyone else can use it...
精彩评论