我正在尝试track down a bug caused by the intersection of MRI 1.8.7 and libxml-1.1.3,并且需要在Ruby解释器本身的代码库中进行一些挖掘。 SVN browser用途有限;我真正想要的是使用LXR,它可以超链接C代码库以便于导航,例如http://lxr.linux.no/perl+perl-5.10.1/utf8.c

我当然可以在机器上设置LXR,但是有人知道那里是否有针对Ruby的公共LXR吗? Google并不是很有帮助:http://www.google.com/search?ie=UTF-8&q=lxr+ruby

最佳答案

我仍然没有找到用于MRI的公共LXR,因此我在机器上设置了一个。在Ubuntu 10.10上执行以下操作的方法:

: josh@josh; cat /etc/issue
Ubuntu 10.10 \n \l
: josh@josh; sudo aptitude install apache2 lxr
: josh@josh; sudo vim /etc/apache2/sites-available/default
: josh@josh; tail -6 /etc/apache2/sites-available/default
Alias /lxr /usr/share/lxr

Options All
AllowOverride All

: josh@josh; sudo vim /usr/share/lxr/http/.htaccess
: josh@josh; sudo cat /usr/share/lxr/http/.htaccess

SetHandler cgi-script

: josh@josh; sudo mkdir -p /usr/share/lxr/source/1.8.7-p334
: josh@josh; cd /usr/share/lxr/source/1.8.7-p334
: josh@josh; sudo tar xvjf /tmp/ruby-1.8.7.tar.bz2
: josh@josh; sudo mv ruby-1.8.7 ruby
: josh@josh; sudo vim /usr/share/lxr/source/versions
: josh@josh; sudo cat /usr/share/lxr/source/versions
1.8.7-p334
: josh@josh; sudo ln -s /usr/share/lxr/source/1.8.7-p334 /usr/share/lxr/source/defversion
: josh@josh; sudo genxref ruby
Starting pass 1: Collect identifier definitions.
(Pass 1) vms/vmsruby_private.c (993), file 1 of 262…
[...]
(Pass 3) identifier 8200 of maximum 17136…
(Pass 3) identifier 8300 of maximum 17136…
Completed pass 3 (0s):Information on 8316 identifiers dumped to disk.
: josh@josh; sudo chmod -R o+r .
: josh@josh; sudo vim /usr/share/lxr/http/lxr.conf
: josh@josh; sudo cat /usr/share/lxr/http/lxr.conf
# Configuration file.
# [...]
# The source is here.
sourceroot: /usr/share/lxr/source/$v/ruby/
srcrootname: Ruby
# [...]

关于c - LXR for Ruby解释器?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5194891/

10-08 22:44