Ruby1.8.1 on FreeBSD

Hi,

I’ve just installed my first FreeBSD 5.1 server and I’m wondering about
Ruby 1.8.1 availability on this OS. When I installed ruby from the ports
tree I get a version 1.6.8 only.

Please give me some pointers of where to look for info, as I’m totally
new to FreeBSD…

Cheers,
Carsten.

Carsten Eckelmann careck@circle42.com writes:

Hi,

I’ve just installed my first FreeBSD 5.1 server and I’m wondering about
Ruby 1.8.1 availability on this OS. When I installed ruby from the ports
tree I get a version 1.6.8 only.

Please give me some pointers of where to look for info, as I’m totally
new to FreeBSD…

Cheers,
Carsten.

Hmm, FYI 5.2-RELEASE is out…

If you are using the ports tree from the CD, then it predates 1.8.1.
You have a few choices:

  1. Update the ports tree. If you want to track ports development,
    the easiest thing to do is install CVSUP. Then you can go to the
    root of the ports tree and “make update”. Only changes will be
    transfered. You’ll have to do some reading about CVSUP in the
    Handbook.

1’) If you don’t care about keeping up-to-date all the time, you can
download a tarfile of the current ports tree. It’s a pretty big
file (>10k ports), so you wouldn’t want to do this often.

  1. Download just the ruby-1.8.1 port directory. The only problem
    with this is that you won’t get the latest version(s) of
    dependencies. That’s not such a big deal though, and (2) is much
    faster than (1’).

You can read about / do all of the above at FreeBSD Ports Search.

Steve

[courtesy cc of this posting sent to cited author via email]

In article 400BD712.4060007@circle42.com,

···

Carsten Eckelmann careck@circle42.com wrote:

Hi,

I’ve just installed my first FreeBSD 5.1 server and I’m wondering about
Ruby 1.8.1 availability on this OS. When I installed ruby from the ports
tree I get a version 1.6.8 only.

You can install lang/ruby18 which will give you 1.8pre_something IIRC then
as the other poster said, update your ports tree which will give you 1.8.1.

Ollivier ROBERT -=- EEC/AMI -=- ollivier.robert@eurocontrol.int
Usenet Canal Historique FreeBSD: The Power to Serve!

I have a question about what is the best way to call Ruby methods which
are implemented in C from C.
The two basic ways I see are :

  1. using one of the rb_funcall[0-9] C functions.
  2. calling the actual C function.
    For example if I am pushing objects onto an array in my C code I could do
    this:

VALUE arr = rb_ary_new2(some_num);
VALUE some_obj = …;
rb_ary_push(arr, some_obj);

or this:

VALUE arr = rb_ary_new2(some_num);
VALUE some_obj = …;
rb_funcall(arr, rb_intern(“push”), 1, some_obj);

So my main question is:
should you only call the C function defined in “ruby.h” directly (not
using rb_funcall) in you extensions or is it OK to call the C functions
defined in “intern.h” directly as well?
thoughts:
I assume “ruby.h” and “intern.h” are seperated for a reason and you should
limit you C code to using stuff from “ruby.h” only, ie don’t include
"intern.h" in your extensions. One reason being that if you don’t use
rb_funcall or a similar function no OO dispatch will take place. So if
someone overrides “push” and you call push using rb_ary_push you won’t be
calling the version of “push” you should be.
Any opinions on this?

-Charlie

Looks like this question was mostly answered by this post
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/1807
but the question still remains is it better to use rb_funcall to invoke
the Ruby method or call the corresponding C function directly?

-Charlie

···

On Mon, 19 Jan 2004, Charles Mills wrote:

VALUE arr = rb_ary_new2(some_num);
VALUE some_obj = …;
rb_ary_push(arr, some_obj);

or this:

VALUE arr = rb_ary_new2(some_num);
VALUE some_obj = …;
rb_funcall(arr, rb_intern(“push”), 1, some_obj);

So my main question is:
should you only call the C function defined in “ruby.h” directly (not
using rb_funcall) in you extensions or is it OK to call the C functions
defined in “intern.h” directly as well?

Hi,

···

At Tue, 20 Jan 2004 01:53:02 +0900, Charles Mills wrote:

Looks like this question was mostly answered by this post
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/1807
but the question still remains is it better to use rb_funcall to invoke
the Ruby method or call the corresponding C function directly?

For an instance made in same function, direct call would be
enough. Otherwise, for an instance given from others, you may
want to consider the case it is a subclass.


Nobu Nakada