Where to download FXRuby library; where to put it; RUBYLIB, RUBYPATH env. vars

Hi,

I’m just starting to do some GUI using Hal Fulton’s excellent intro to
FXRuby in “The Ruby Way”. His first example worked “out of the box.” (I’m
running ruby 1.8.0 (2003-08-04) [i386-mswin32]). The example required "fox"
and included Fox, but I don’t see “fox.rb” anywhere in my Ruby
installation – only a couple of Fox folders. So what satisfied these
require/include statements?

Second, I ran the next example, which in addition to the fox stuff,
required/included “responder”/Responder. That barfed until I added a fully
qualified path to the RUBYLIB env. var., whereupon the dark clouds
dissipated and the sun shone through. If Ruby found Fox in the prev.
example, why couldn’t it find responder.rb in the Fox folder without the
assistance of RUBLIB, suitably initialized?

Third, I’ve got the fully qualifed path to Ruby/lib in the RUBYLIB var.
also. That’s probably redudant, isn’t it? Ruby seems to find stuff in
Ruby/lib without that entry in RUBYLIB.

Thanks in advance,
Richad

···

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.687 / Virus Database: 448 - Release Date: 5/17/2004

Richard Lionheart wrote:

I’m just starting to do some GUI using Hal Fulton’s excellent intro to
FXRuby in “The Ruby Way”. His first example worked “out of the box.” (I’m
running ruby 1.8.0 (2003-08-04) [i386-mswin32]). The example required “fox”
and included Fox, but I don’t see “fox.rb” anywhere in my Ruby
installation – only a couple of Fox folders. So what satisfied these
require/include statements?

Thanks for the compliment. Most of that section was written by someone
else, as it happens. :slight_smile:

Be sure to check out the latest docs on fxruby.org, as the book is
rather old with regard to fxruby.

As for the require: Without looking, I guess it’s fox.so that it finds.

Second, I ran the next example, which in addition to the fox stuff,
required/included “responder”/Responder. That barfed until I added a fully
qualified path to the RUBYLIB env. var., whereupon the dark clouds
dissipated and the sun shone through. If Ruby found Fox in the prev.
example, why couldn’t it find responder.rb in the Fox folder without the
assistance of RUBLIB, suitably initialized?

Hmm, is fox.so in the same dir with responder.rb? My guess is no.

Third, I’ve got the fully qualifed path to Ruby/lib in the RUBYLIB var.
also. That’s probably redudant, isn’t it? Ruby seems to find stuff in
Ruby/lib without that entry in RUBYLIB.

I think so.

Hal

If you’re on Windows (as it looks like you are), then you can just use the
one-click prag-prog installer which will take care of all of the setup for
you (Fox and FXRuby included).

For the one-click installer you could go to
http://rubyforge.org/frs/?group_id=167

-Rich

Newsgroups: comp.lang.ruby

···

----- Original Message -----
From: “Richard Lionheart” NoOne@Nowhere.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Wednesday, May 19, 2004 9:20 PM
Subject: Where to download FXRuby library; where to put it; RUBYLIB,
RUBYPATH env. vars

Hi,

I’m just starting to do some GUI using Hal Fulton’s excellent intro to
FXRuby in “The Ruby Way”. His first example worked “out of the box.”
(I’m
running ruby 1.8.0 (2003-08-04) [i386-mswin32]). The example required
“fox”
and included Fox, but I don’t see “fox.rb” anywhere in my Ruby
installation – only a couple of Fox folders. So what satisfied these
require/include statements?

Second, I ran the next example, which in addition to the fox stuff,
required/included “responder”/Responder. That barfed until I added a
fully
qualified path to the RUBYLIB env. var., whereupon the dark clouds
dissipated and the sun shone through. If Ruby found Fox in the prev.
example, why couldn’t it find responder.rb in the Fox folder without the
assistance of RUBLIB, suitably initialized?

Third, I’ve got the fully qualifed path to Ruby/lib in the RUBYLIB var.
also. That’s probably redudant, isn’t it? Ruby seems to find stuff in
Ruby/lib without that entry in RUBYLIB.

Thanks in advance,
Richad


Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.687 / Virus Database: 448 - Release Date: 5/17/2004

Richard Lionheart wrote:

Second, I ran the next example, which in addition to the fox stuff,
required/included “responder”/Responder. That barfed until I added a fully
qualified path to the RUBYLIB env. var…

I don’t have Hal’s book in front of me at the moment, but you should be
doing this:

require 'fox/responder'

and not this:

require 'responder'

The examples may be a little out of date. With the exception of the
‘fox’ module itself, all of the other sub-modules for FXRuby are stored
in the ‘fox’ subdirectory, e.g.

require 'fox'
require 'fox/calendar'

Hope this helps,

Lyle

Hi Hal,

I’m just starting to do some GUI using Hal Fulton’s excellent intro to
FXRuby in “The Ruby Way”. His first example worked “out of the box.”

Thanks for the compliment. Most of that section was written by someone
else, as it happens. :slight_smile:

It’s well deserved: all the examples that were complete programs ran “out of
the box” once my RUBYLIB was brought up to snuff. Thankfully, they were on
the site you indicated, so I didn’t have to key in anything.

Incidentally, I ran all the examples under SciTE, which worked even better
after I changed the line
command.go.*.rb=ruby $(FileNameExt)
in the Ruby.properties file to use rubyw rather than ruby. I consulted one
of the maintainers of SciTE about my change and have yet to receive his
“blessing,” but it works well for me in that no spurious Command window is
opened as I run these GUI apps (and non-GUI apps still run correctly.)

The example required “fox”
and included Fox, but I don’t see “fox.rb” anywhere in my Ruby
installation – only a couple of Fox folders. So what satisfied these
require/include statements?

As for the require: Without looking, I guess it’s fox.so that it finds.

Sounds plausible. It’s the only fox.??? file in the Ruby installation.
It’s tucked away in Ruby\lib\ruby\site_ruby\1.8\i386-msvcrt, which the Ruby
interpreter knows implicitly, apparently.

Be sure to check out the latest docs on fxruby.org, as the book is
rather old with regard to fxruby.

THANKS. That was going to be my next question as I saw your references to
other widgets. I had poked around on Google earlier but did not see that
site recommended in response to my queries.

Second, I ran the next example, which in addition to the fox stuff,
required/included “responder”/Responder. That barfed until I added a
fully
qualified path to the RUBYLIB env. var.,[snip]

Hmm, is fox.so in the same dir with responder.rb? My guess is no.

Correct. fox.so’s location is given above. responder.rb is in
Ruby\site_ruby\1.8\fox.

Third, I’ve got the fully qualifed path to Ruby/lib in the RUBYLIB var.
also. That’s probably redudant, isn’t it?

I think so.

Great. I’ll clean that up.

Best wishes,
Richard

···

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.687 / Virus Database: 448 - Release Date: 5/18/2004

Hi Rich,

Thanks for the response. Now that I’ve got all the FXRuby stuff from Hal’s
book working, I think my installation might be fine … the main problem is
I didn’t understand how the require/rubylib scheme fit together (and that
“require fox” is satisfied by fox.so in the bowel of the Ruby installation.)
So it appears that FXRuby is installed on my system.

If you’re on Windows (as it looks like you are), then you can just use the
one-click prag-prog installer which will take care of all of the setup for
you (Fox and FXRuby included).

For the one-click installer you could go to
http://rubyforge.org/frs/?group_id=167

Thanks for the link. It appears that the original developent effort for
this tool was on SourceForge but has moved to RubyForge.

I think I downloaded a zip file from SourceForge and installed simply by
extracting into a suitable directory. Since I manually unzipped, my
environment was not set up properly. Now with RUBYLIB set to
Ruby\site_ruby\1.8\fox, things seem to be smoothe.

Do you think I can gain much by wiping out my installation and using the
installer from RubyForge?

Best wishes,
Richard

···

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.687 / Virus Database: 448 - Release Date: 5/18/2004

Hi Lyle,

Hi Lyle,

Thanks for your posts.

What I had (which worked) was:

RUBYLIB = I:\Program Files\Ruby\lib\ruby\site_ruby\1.8\fox

and

require "responder"

As I understand your advice, which I’ve tried and it works (as you
expected), is to drop \fox from the first and prefix fox/ in the latter.
(BTW, prefixing fox\ does NOT work, despite the fact I running Win2000Pro
… it looks like the conversion from \ to / happens when the environment is
first accessed.)

It seems to me that the rationale underlying your approach is that I can
equally well reference other packages parallel to the fox folder without
changing RUBYLIB each time.

I’d like to check one other issue: in your judgement, what’s the purpose
of the initial ‘require “fox”’ statement. Hal speculated it references the
fox.so library (interesting, a Unix extension in a Windows environment) and
that the interpreter has a built-in path to it (its located in
Ruby\lib\ruby\site_ruby\1.8\i386-msvcrt).

Again, thanks for your insights.

Regards,
Richard

···

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.687 / Virus Database: 448 - Release Date: 5/18/2004

Hi Lyle,

I just downloaded a neat FXRuby package, ListView, from
http://www.netpromi.com/listview.html. It came with a sample app using it.
I thought I might make use of it later, so I peeled off the example into an
Examples\Ruby subdir and the pkg’s files in the folder Ruby\lib\listview.

But that seems wrong because it might get wiped out when Ruby is updated.
On the other hand, it looks like Ruby updates will go into Ruby\1.9 and
Ruby\lib\ruby\site_ruby\1.9, for example, and thus not touch Ruby\lib.

Do you have an opinion?

Regards,
Richard

···

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.687 / Virus Database: 448 - Release Date: 5/18/2004

Richard Lionheart wrote:

I think I downloaded a zip file from SourceForge and installed simply by
extracting into a suitable directory. Since I manually unzipped, my
environment was not set up properly. Now with RUBYLIB set to
Ruby\site_ruby\1.8\fox, things seem to be smoothe.

Richard,

Per my previous reply (which I know you haven’t read yet) you should
not modify your RUBYLIB environment variable to add
“…/site_ruby/1.8/fox” to it; you should instead fix the require’s in
your code to load modules (such as ‘responder’) from that subdirectory, e.g.

require 'fox/responder'

If you leave your code the way it is currently, it’s not going to work
on anyone else’s installation. :wink:

Hope this helps,

Lyle

Richard Lionheart wrote:

As I understand your advice, which I’ve tried and it works (as you
expected), is to drop \fox from the first and prefix fox/ in the latter.
(BTW, prefixing fox\ does NOT work, despite the fact I running Win2000Pro
… it looks like the conversion from \ to / happens when the environment is
first accessed.)

Yes, I would guess that if you do something like:

require 'fox\responder'

that Ruby is interpreting the '' character as an escape code or
something. I just always use the ‘/’ character as the path separator for
require() and it works fine.

It seems to me that the rationale underlying your approach is that I can
equally well reference other packages parallel to the fox folder without
changing RUBYLIB each time.

Yes, sure. This is a pretty standard approach for most Ruby libraries.

I’d like to check one other issue: in your judgement, what’s the purpose
of the initial ‘require “fox”’ statement. Hal speculated it references the
fox.so library (interesting, a Unix extension in a Windows environment) and
that the interpreter has a built-in path to it (its located in
Ruby\lib\ruby\site_ruby\1.8\i386-msvcrt).

Sorry I didn’t address that question in my previous response. Yes, Hal
was correct that the ‘require “fox”’ line loads in the main extension
file, fox.so. Most of the code that makes up the FXRuby extension is
compiled C++ code and lives in this file. Some of the supporting code
(e.g. responder.rb), which is written in Ruby, lives in the “fox”
subfolder. And despite its extension (.so), fox.so is just your basic
DLL on Windows. And yes, the path to it is built-in to the interpreter;
you should be able to check to see what the default RUBYLIB is by typing:

ruby -e 'puts $:'

For example, on my Apple PowerBook (from which I’m sending this message)
the above command prints:

/sw/lib/ruby/site_ruby/1.8
/sw/lib/ruby/site_ruby/1.8/powerpc-darwin
/sw/lib/ruby/site_ruby
/sw/lib/ruby/1.8
/sw/lib/ruby/1.8/powerpc-darwin
.

where “powerpc-darwin” is the OS, just like “i386-msvcrt” is on your PC.

Hope this helps,

Lyle

Richard Lionheart wrote:

I just downloaded a neat FXRuby package, ListView, from
http://www.netpromi.com/listview.html. It came with a sample app using it.
I thought I might make use of it later, so I peeled off the example into an
Examples\Ruby subdir and the pkg’s files in the folder Ruby\lib\listview.

But that seems wrong because it might get wiped out when Ruby is updated.
On the other hand, it looks like Ruby updates will go into Ruby\1.9 and
Ruby\lib\ruby\site_ruby\1.9, for example, and thus not touch Ruby\lib.

You’re right that the listview widget is independent of the Ruby version
(i.e. it’s not specific to Ruby 1.8 or 1.9). Since the
lib/ruby/site_ruby directory is (I think) where your non-standard
libraries are supposed to go, however, I think that’s the appropriate
place to create a “listview” folder.

Assuming that your Ruby installation has a directory structure something
like this:

I:\Program Files\Ruby\lib\ruby\site_ruby\1.8
I:\Program Files\Ruby\lib\ruby\site_ruby\1.8\i386-msvcrt
I:\Program Files\Ruby\lib\ruby\site_ruby
I:\Program Files\Ruby\lib\ruby\1.8
I:\Program Files\Ruby\lib\ruby\i386-msvcrt

then the directory you want to create is this one:

I:\Program Files\Ruby\lib\ruby\site_ruby\listview

Note that this folder appears directly under lib/ruby/site_ruby, which
should be in the standard RUBYLIB search path by default. You should
not need to alter your RUBYLIB environment variable after making this
change. Copy the file(s) into that subdirectory and then access them
from your FXRuby program like this:

require 'listview/foo.rb'

Hope this helps,

Lyle

Richard Lionheart wrote:

I just downloaded a neat FXRuby package, ListView, from
http://www.netpromi.com/listview.html. It came with a sample app using it.
I thought I might make use of it later, so I peeled off the example into an
Examples\Ruby subdir and the pkg’s files in the folder Ruby\lib\listview.

But that seems wrong because it might get wiped out when Ruby is updated.
On the other hand, it looks like Ruby updates will go into Ruby\1.9 and
Ruby\lib\ruby\site_ruby\1.9, for example, and thus not touch Ruby\lib.

You’re right that the listview widget is independent of the Ruby version
(i.e. it’s not specific to Ruby 1.8 or 1.9). Since the
lib/ruby/site_ruby directory is (I think) where your non-standard
libraries are supposed to go, however, I think that’s the appropriate
place to create a “listview” folder.

Assuming that your Ruby installation has a directory structure something
like this:

I:\Program Files\Ruby\lib\ruby\site_ruby\1.8
I:\Program Files\Ruby\lib\ruby\site_ruby\1.8\i386-msvcrt
I:\Program Files\Ruby\lib\ruby\site_ruby
I:\Program Files\Ruby\lib\ruby\1.8
I:\Program Files\Ruby\lib\ruby\i386-msvcrt

then the directory you want to create is this one:

I:\Program Files\Ruby\lib\ruby\site_ruby\listview

Note that this folder appears directly under lib/ruby/site_ruby, which
should be in the standard RUBYLIB search path by default. You should
not need to alter your RUBYLIB environment variable after making this
change. Copy the file(s) into that subdirectory and then access them
from your FXRuby program like this:

require 'listview/foo.rb'

Hope this helps,

Lyle

Hi,

Lyle,

Sounds great. Thanks for the guidance.

Regards,
Richard Muller

“Lyle Johnson” lyle@knology.net wrote in message
news:40AD6C74.1040400@knology.net

Richard Lionheart wrote:

I just downloaded a neat FXRuby package, ListView, from
http://www.netpromi.com/listview.html. It came with a sample app using
it.
I thought I might make use of it later, so I peeled off the example
into an
Examples\Ruby subdir and the pkg’s files in the folder
Ruby\lib\listview.

But that seems wrong because it might get wiped out when Ruby is
updated.

···

On the other hand, it looks like Ruby updates will go into Ruby\1.9 and
Ruby\lib\ruby\site_ruby\1.9, for example, and thus not touch Ruby\lib.

You’re right that the listview widget is independent of the Ruby version
(i.e. it’s not specific to Ruby 1.8 or 1.9). Since the
lib/ruby/site_ruby directory is (I think) where your non-standard
libraries are supposed to go, however, I think that’s the appropriate
place to create a “listview” folder.

Assuming that your Ruby installation has a directory structure something
like this:

I:\Program Files\Ruby\lib\ruby\site_ruby\1.8
I:\Program Files\Ruby\lib\ruby\site_ruby\1.8\i386-msvcrt
I:\Program Files\Ruby\lib\ruby\site_ruby
I:\Program Files\Ruby\lib\ruby\1.8
I:\Program Files\Ruby\lib\ruby\i386-msvcrt

then the directory you want to create is this one:

I:\Program Files\Ruby\lib\ruby\site_ruby\listview

Note that this folder appears directly under lib/ruby/site_ruby, which
should be in the standard RUBYLIB search path by default. You should
not need to alter your RUBYLIB environment variable after making this
change. Copy the file(s) into that subdirectory and then access them
from your FXRuby program like this:

require ‘listview/foo.rb’

Hope this helps,

Lyle


Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.688 / Virus Database: 449 - Release Date: 5/19/2004

Hi Lyle,

Thanks for these add’l details. There were so many responses on this thread
that I missed this particular post until I checked back today.

Again, thanks for all your insights.

Regards,
Richard

“Lyle Johnson” lyle@knology.net wrote in message
news:40AD6930.1060208@knology.net

Richard Lionheart wrote:

As I understand your advice, which I’ve tried and it works (as you
expected), is to drop \fox from the first and prefix fox/ in the
latter.
(BTW, prefixing fox\ does NOT work, despite the fact I running
Win2000Pro
… it looks like the conversion from \ to / happens when the
environment is
first accessed.)

Yes, I would guess that if you do something like:

require ‘fox\responder’

that Ruby is interpreting the '' character as an escape code or
something. I just always use the ‘/’ character as the path separator for
require() and it works fine.

It seems to me that the rationale underlying your approach is that I can
equally well reference other packages parallel to the fox folder without
changing RUBYLIB each time.

Yes, sure. This is a pretty standard approach for most Ruby libraries.

I’d like to check one other issue: in your judgement, what’s the
purpose
of the initial ‘require “fox”’ statement. Hal speculated it references
the
fox.so library (interesting, a Unix extension in a Windows environment)
and

···

that the interpreter has a built-in path to it (its located in
Ruby\lib\ruby\site_ruby\1.8\i386-msvcrt).

Sorry I didn’t address that question in my previous response. Yes, Hal
was correct that the ‘require “fox”’ line loads in the main extension
file, fox.so. Most of the code that makes up the FXRuby extension is
compiled C++ code and lives in this file. Some of the supporting code
(e.g. responder.rb), which is written in Ruby, lives in the “fox”
subfolder. And despite its extension (.so), fox.so is just your basic
DLL on Windows. And yes, the path to it is built-in to the interpreter;
you should be able to check to see what the default RUBYLIB is by typing:

ruby -e ‘puts $:’

For example, on my Apple PowerBook (from which I’m sending this message)
the above command prints:

/sw/lib/ruby/site_ruby/1.8
/sw/lib/ruby/site_ruby/1.8/powerpc-darwin
/sw/lib/ruby/site_ruby
/sw/lib/ruby/1.8
/sw/lib/ruby/1.8/powerpc-darwin
.

where “powerpc-darwin” is the OS, just like “i386-msvcrt” is on your PC.

Hope this helps,

Lyle


Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 5/23/2004