开发者

Unable to run fastri on cygwin: uninitialized constant Gem::Version (NameError)

I'm trying to setup fastri (http://eigenclass.org/hiki/fastri) on emacs running on cygwin in windows. The ruby install is also from cygwin, not the windows version of ruby. After downloading, unpacking the tarball and running setup.rb, when I attempt to run qri or fri, I get the following error message:

    [/cygdrive/g]$qri
/usr/lib/ruby/1.8/rdoc/ri/ri_paths.rb:63: uninitialized constant Gem::Version (NameError)
    from /usr/lib/ruby/1.8/rdoc/ri/ri_paths.rb:59:in `each'
    from /usr/lib/ruby/1.8/rdoc/ri/ri_paths.rb:59
    from /usr/lib/ruby/site_ruby/1.8/fastri/util.rb:38:in `require'
    from /usr/lib/ruby/site_ruby/1.8/fastri/util.rb:38
    from /usr/bin/qri:6:in `require'
    from /usr/bin/qri:6

My ruby version and gem environment:

[/cygdrive/g]$ruby --version
ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin]
[/cygdrive/g]$gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.4
  - RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin]
  - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /usr/bin/ruby.exe
  - EXECUTABLE DIRECTORY: /usr/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-cygwin
  - GEM PATHS:
     - /usr/lib/ruby/gems/1.8
     - /home/rrajagop/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/

I took a look at ri_p开发者_C百科aths.rb to figure out how Gem::Version should be included in the file, but I couldn't figure it out. I tried adding both require 'gem/version' and require 'version' in ri_paths.rb, but no joy. I get 'require': no such file to load -- version (LoadError)


Ok, I finally got it working. Adding require 'rubygems/version' in ri_path.rb fixed it.

Basically, used puts $: to figure out the paths that require will search thru', found out where Gem::Version was defined (I already had a pre-built tags table for ruby and all my gems, so this was easy), and worked out the path to version from the closest component of the search path. Sounds simple, right? Of course, all this took me a couple of days, the ruby noob that I am.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜