Re: ruby/gnuplot on windows

Dear Jon,

ruby myfile.rb
where does myfile.rb have to be?

Just save it in the directory you’re in. That could be something like

/home/jon .

If you want to know where you are, type in

pwd

(It’s a good idea - in the long run - to look at some introductory
Unix/Linux course in a library or in the internet to get all those
common commands and seee how they’re used - don’t be
afraid of options :-)).

Maybe you already have

/home,

(check that by typing in

ls /home )

You can create create the directory /home/jon by typing in

mkdir /home/jon

Now, your second question:

ruby myfile.rb
ruby: no such file to load – ubygems (load error)

Here, you are trying to require rubygems in myfile.rb to load some gem
file
(gnuplot bindings and many other nice things are distributed
conveniently
as “gems” in Ruby), and that is not installed, and/or the program that
loads it is not installed.
You need to get it first. See how to install it here:

_http://docs.rubygems.org/read/chapter/3_
(http://docs.rubygems.org/read/chapter/3)

Some explanations to that manual:
Somewhere, they talk about something you should do as “root”.
You can ignore that in Cygwin.

( It means that on a Linux machine,
there is a system administrator who has more rights than individual
users. Users can only read, write, execute files they have a right to,
and a system administrator can do all of that and change those rights
and cause at lot of harm, also. If you later decide to install Linux
also on your machine, the installation process will ask you to set
a root password and some user password. You’ll then log in as root,
(typing in
su
at a console and that password). if you want to do maintenance work
an dangerous things; then you administrate your system :).)

The things written with a blue background a things you need
to type in at the console (you open that by clicking on either of
the two Cygwin icons).
I think you can use all the directory settings as they give them there.
To set a path, just try both the

export GEM_HOME=/home/mygemrepository

and

set GEM_HOME=/home/mygemrepository

commands, one of them should work (probably the last one).

If you have come to 3.4 in the manual, you can now install
new gems by typing in

gem install <my_gem>

if you like to use the gem called <my_gem>. This will search for such a
gem,
first locally, then in the internet repository .

When that is done, you use that gem, as described in
“The Hard Way” in your script file myfile.rb :

require “rubygems”
require <my_gem> .
… and now all sorts of awesome ruby commands to make the world
a better place.

Best regards,

Axel

PS. Please let me know how it goes.

Axel,

Just save it in the directory you’re in. That could be something like

/home/jon .

Thats what I was doing, so far so good.

Now, your second question:
Here, you are trying to require rubygems in myfile.rb to load some gem
file

myfile.rb consists of:

puts “Hello world”

thats it. No require statements. But I tried to install rubygems. I
downloaded the tar.gz file. Unpacked it and put the folder in
/lib/ruby. Then:

$cd /lib/ruby/rubygems-0.8.11
$ruby setup.rb
ruby: no such file to load – ubygems (Load Error)

Then I try:

$export GEM_HOME=/home/mygemrepository … ok, no error returned
$ruby setup.rb config --prefix=/home/jon
ruby: no such file to load – ubygems (Load Error)

I can’t seem to run any ruby file.

$ruby -v … works
ruby 1.8.4 (2005-12-24) [i386-cygwin]

So I remembered that I still had the windows one-click version of ruby
installed and thought that that might cause some trouble, so I
uninstalled it. Nothing chnaged. Could it be a problem with an
environment variable? I’m not sure what I would need to set if it was.

Jon

On Fri, 19 May 2006, Jon D. wrote:

file
$ruby setup.rb
$ruby -v … works
ruby 1.8.4 (2005-12-24) [i386-cygwin]

So I remembered that I still had the windows one-click version of ruby
installed and thought that that might cause some trouble, so I
uninstalled it. Nothing chnaged. Could it be a problem with an
environment variable? I’m not sure what I would need to set if it was.

Jon

unset RUBYOPT

-a

unknown wrote:

On Fri, 19 May 2006, Jon D. wrote:

file
$ruby setup.rb
$ruby -v … works
ruby 1.8.4 (2005-12-24) [i386-cygwin]

So I remembered that I still had the windows one-click version of ruby
installed and thought that that might cause some trouble, so I
uninstalled it. Nothing chnaged. Could it be a problem with an
environment variable? I’m not sure what I would need to set if it was.

Jon

unset RUBYOPT

-a

RUBYOPT was unset when I unistalled the windows ruby and is no longer an
environment variable

jon

On Fri, 19 May 2006, Jon D. wrote:

uninstalled it. Nothing chnaged. Could it be a problem with an

jon

then something is fishy. the error you showed is caused by

RUBYOPT=’-rubygems’

what does this say

harp:~ > ruby -r yaml -e’ y ENV[% RUBYOPT ] ’

??

-a

I haven’t yet tried gnuplot which got me started on this in the first
place. I’ll let you know how that goes in a few hours (I have to work
now). Again, thanks for all the help.

Axel,

Tried to run a straight gnuplot file in cygwin.

$gnuplot -persist test.plt

Like your file g.plt, it contained a single line plot sin(x). No error
but no plot either. If I put in pause -1, I do get a pause but no plot.

jon

Jon D. wrote:

I haven’t yet tried gnuplot which got me started on this in the first
place. I’ll let you know how that goes in a few hours (I have to work
now). Again, thanks for all the help.

Axel,

Tried to run a straight gnuplot file in cygwin.

$gnuplot -persist test.plt

Like your file g.plt, it contained a single line plot sin(x). No error
but no plot either. If I put in pause -1, I do get a pause but no plot.

jon

Ok, I opened gnuplot through cygwin

$gnuplot
Terminal type set to ‘unknown’ … ‘unknown’ is not a plotting device

I then entered

set terminal

for a list of terminal types. Windows isn’t one of them. What type of
terminal should I set? Can I alter gnuplot.exe so that its default is a
type compatible with cygwin?

jon

On May 18, 2006, at 10:12 PM, Jon D. wrote:

is a
type compatible with cygwin?

jon


Posted via http://www.ruby-forum.com/.

A gnuplot terminal is not a terminal in the sense of VT100 or an
xterm, etc. It’s the display of the graph. You can set it to one of
the file format ones and view the results in another program.

Logan C. wrote:

On May 18, 2006, at 10:12 PM, Jon D. wrote:

is a
type compatible with cygwin?

jon


Posted via http://www.ruby-forum.com/.

A gnuplot terminal is not a terminal in the sense of VT100 or an
xterm, etc. It’s the display of the graph. You can set it to one of
the file format ones and view the results in another program.

So is there no way to view the graph without exporting it to file and
then opening it in another program? By using cygwin you lose the
windows option to view the graph interactively?

unknown wrote:

On Fri, 19 May 2006, Jon D. wrote:

uninstalled it. Nothing chnaged. Could it be a problem with an

jon

then something is fishy. the error you showed is caused by

RUBYOPT=’-rubygems’

what does this say

harp:~ > ruby -r yaml -e’ y ENV[% RUBYOPT ] ’

??

-a

Ok, good news. After I unistalled the windows ruby, I didn’t re-start
my computer. Usually when things aren’t working that should, I have to
restart the computer. Things appear to be working now:

ruby myfile.rb … works
ruby setup.rb … for gems, works

I haven’t yet tried gnuplot which got me started on this in the first
place. I’ll let you know how that goes in a few hours (I have to work
now). Again, thanks for all the help.

jon