source browser anywhere?

D

Dick Davies

Just trying to pick my way through a fairly typical ruby code tree.

[ rubygems in fact - I'm very impressed with it so far, looks like CPAN-done-right - I
wanted to see how it works and contribute if I can. ]

It's split across maybe half-a-dozen files , which are pretty readable. At first
glance I'd guess about 1000-odd lines of code and half-a-dozen classes.

In this case, the code is well laid out and small enough to get your head round all
in one go. (They say the human mind can remember 7 things at once, so I can do the
source files and breathe at the same time. So long as no one tries to talk to me
I should just about manage it).

A larger package would be much harder to get your head round all in one go...
drb and webrick have always seemed a bit daunting to me because of the number of
classes and files involved.

In the past, when I did this with a C app (like the ruby binary),
I'd use 'ctree' and it would pick out the definitions of a function or macro from
the source tree (and would even look in include files for system calls, etc.)

A screen session running vim per file is a bit cumbersome, but the best
I got.

Then I realised a lot of you guys (the ones who write these packages, anyway) must
have a way of doing this.

Is there anything like ctree for ruby code? That is, a source browser that can
find definitions of classes and methods across multiple files.

Ideally: textmode, vi(m) friendly and unencumbered... must enjoy long walks in
the country, smoker preferred, yadda, yadda.
 
M

Mauricio Fernández

A screen session running vim per file is a bit cumbersome, but the best
I got.

What about vim w/ each file on a separate window, and these mappings:

map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_

?

Then I realised a lot of you guys (the ones who write these packages, anyway) must
have a way of doing this.

Is there anything like ctree for ruby code? That is, a source browser that can
find definitions of classes and methods across multiple files.

you can use (exuberant) ctags for Ruby, but last time I tried it didn't
work very well: Foo#bar and Bar#bar were not differentiated IIRC.
Ideally: textmode, vi(m) friendly and unencumbered... must enjoy long walks in
the country, smoker preferred, yadda, yadda.

--
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

*** PUBLIC flooding detected from erikyyy
<lewnie> THAT's an erik, pholx.... ;)
-- Seen on #LinuxGER
 
J

Jim Weirich

Dick Davies said:
Is there anything like ctree for ruby code? That is, a source browser that
can
find definitions of classes and methods across multiple files.

Ideally: textmode, vi(m) friendly and unencumbered... must enjoy long
walks in
the country, smoker preferred, yadda, yadda.

This is not /quite/ what you asked for, but I've found myself using the
Ruby mode available for eclipse to do source code browsing. The tree at
the left allows you to find definitions quickly. I still do most of my
programming in Emacs, but browsing is nice eclipse.

Warning: Eclipse is HUGE and is overkill for ruby unless you are using it
already. Since I do Java coding at work, I normally have Eclipse up and
running anyways.

Another option is FreeRIDE which will give you a similar style browser to
the Eclipse/Ruby one, and doesn't have all the overhead of Eclipse.
 
D

Dick Davies

* Mauricio Fern?ndez said:
What about vim w/ each file on a separate window, and these mappings:

map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_

?

I think that's probably my best bet, thanks. It saves cluttering the screen
session and is languace agnostic, I'll give that a whirl...
you can use (exuberant) ctags for Ruby, but last time I tried it didn't
work very well: Foo#bar and Bar#bar were not differentiated IIRC.

I'll take a look - 'doesn't work very well' is better than what I have,


[ thanks for other offers/suggestions, Eclipse is a nono because

a) it's a GUI - might sound stupid, but a day on a mouse causes me physical pain -
b) Java support on my OS is pretty awful (It's not Windows or Leenux basically]
c) I don't got the RAM for it. Speaking of which,

I'm too old to learn emacs now - I'd have to have the kid re-baptized for a start...

Thanks for the suggestions, everyone.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top