Source browser anywhere?

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.

···


Rasputin :: Jack of All Trades - Master of Nuns

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 j_
map k_

?

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.

···

On Fri, Apr 16, 2004 at 04:38:33AM +0900, Dick Davies wrote:

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
THAT’s an erik, pholx… :wink:
– Seen on #LinuxGER

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.

···


– Jim Weirich jim@weirichhouse.org http://onestepback.org

“Beware of bugs in the above code; I have only proved it correct,
not tried it.” – Donald Knuth (in a memo to Peter van Emde Boas)

Eclipse is great when I am coding in Ruby and writing HTML in the same
project. I can flip from one file type to another at will, manage all of
the routine CVS stuff from the user interface, and have a nice tree of the
project up, all within the same IDE. It’s great.

Kirk Haines

···

On Fri, 16 Apr 2004, Jim Weirich wrote:

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.

If you prefer emacs and use eclipse just for some browsing stuff you
should have a look at “emacs code browser”, see
http://ecb.sourceforge.net/.

Cheers
Sascha

···

“Jim Weirich” jim@weirichhouse.org wrote:

I still do most of my
programming in Emacs, but browsing is nice eclipse.

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 j_
map k_

?

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…

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.

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.

···

On Fri, Apr 16, 2004 at 04:38:33AM +0900, Dick Davies wrote:


Eat, drink, and be merry, for tomorrow you may work.
Rasputin :: Jack of All Trades - Master of Nuns