Ruby and Cygwin


#1

Hi all,

I install a Ruby version from within Cygwin. 1) How do I use
Interreactive ruby from Cygwin? 2) How do I query Ruby from Cygwin? 3)
Which text editor do you guys prefer when working under Cygwin?

Thanks,

Li


#2

Li Chen wrote:

Well, before the anti-cygwin folks jump in here :slight_smile:

  1. Just open a Cygwin command window (or an xterm) and type “irb” at the
    prompt.
  2. I’m not sure what you mean by “query Ruby”?
  3. Cygwin has vim, emacs and xemacs. I prefer vim. If you have Cygwin X,
    you also will have “gvim”.

Other notes:

  1. If you download and install the “gem” tarball, RubyGems works as
    advertised.
  2. I have not tried the Cygwin compile/link toolchain with C extensions,
    so I don’t know if that works or not. That’s the main reason people
    don’t like the Cygwin port – it’s confusing for all except “pure Ruby”
    to have to deal with three different compilers – Microsoft’s, “mingw”
    and Cygwin’s.

If you need to deal with non-Ruby extensions, my recommendation would be
to get the one-click installer and use the precompiled Gems, rather than
trying to mess with Cygwin. But if you’re dealing with pure Ruby, Cygwin
is fine.


M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC§
http://borasky-research.blogspot.com/

If God had meant for carrots to be eaten cooked, He would have given
rabbits fire.


#3

M. Edward (Ed) Borasky wrote:

  1. Just open a Cygwin command window (or an xterm) and type “irb” at the
    prompt.

It doesn’t work for me.

chen41@path-1qydp61 ~
$ irb
/usr/bin/ruby: no such file to load – ubygems (LoadError)

  1. I’m not sure what you mean by “query Ruby”?
    search methods such as C:>ri Array.new

Li


#4

M. Edward (Ed) Borasky wrote:

Ah … type “unset RUBYOPT” at the command prompt and try it again

It works. But what annoys me is that I have to type this commmand every
time when I start a new window. Is there another way to avoid this
situation?

Or install rubygems.

How? Where can I find this howto under Cygwin ?

BTW: Is it possible to run a Ruby script from within gvim editor?

Thanks,

Li


#5

M. Edward (Ed) Borasky wrote:

  1. Cygwin has vim, emacs and xemacs. I prefer vim. If you have Cygwin X,
    you also will have “gvim”.

Of which all three (four?) exist and work under Windows natively, so you
can spare yourself an epicycle there unless you’re sshing into the
Cygwin setup.

David V.


#6

Li Chen wrote:

/usr/bin/ruby: no such file to load – ubygems (LoadError)

  1. I’m not sure what you mean by “query Ruby”?

search methods such as C:>ri Array.new

Li

Ah … type “unset RUBYOPT” at the command prompt and try it again

Or install rubygems.


M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC§
http://borasky-research.blogspot.com/

If God had meant for carrots to be eaten cooked, He would have given
rabbits fire.


#7

Jim C. wrote:

(Assuming that the shell you are using is bash, which, AFAIK is the
default shell in cygwin:) Put the unset command in the .bash_profile
file in your home directory. If you need more info. about this, try the
cygwin docs and/or ask some more questions in an appropriate usenet
group.
(This group is probably appropriate, but there may be better one - with
more cygwin experts.)

I search google and find out how to avoid it by deleting RUBYOPT from
path within enviroment variables under XP.

Li


#8

David V. wrote:

David V.

I will add, as a happy GVim user, that the Windows native version is
much more attractive than either the Cygwin X-Windows “gvim” or its
Linux cousin/ancestor. When I’m on Windows, I use Windows GVim, and when
I’m on Linux or Cygwin, I use the regular “vim” from an XTerm or other
command shell window.

I never bothered to learn either emacs or xemacs, so I can’t comment on
their use, either native Windows or Cygwin/Linux.


M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC§
http://borasky-research.blogspot.com/

If God had meant for carrots to be eaten cooked, He would have given
rabbits fire.


#9

On 2006-12-23, Li Chen removed_email_address@domain.invalid wrote:

path within enviroment variables under XP.

Li

Yes, that’s a better solution.


#10

On 2006-12-23, Li Chen removed_email_address@domain.invalid wrote:

M. Edward (Ed) Borasky wrote:

Ah … type “unset RUBYOPT” at the command prompt and try it again

It works. But what annoys me is that I have to type this commmand every
time when I start a new window. Is there another way to avoid this
situation?

(Assuming that the shell you are using is bash, which, AFAIK is the
default shell in cygwin:) Put the unset command in the .bash_profile
file in your home directory. If you need more info. about this, try the
cygwin docs and/or ask some more questions in an appropriate usenet
group.
(This group is probably appropriate, but there may be better one - with
more cygwin experts.)


#11

M. Edward (Ed) Borasky wrote:

I will add, as a happy GVim user, that the Windows native version is
much more attractive than either the Cygwin X-Windows “gvim” or its
Linux cousin/ancestor. When I’m on Windows, I use Windows GVim

How do you run a Ruby script using Windows GVim? What I do is to write
a script with GVim, save it, then open a window prompt, CD to the folder
containing the script, and run it with “ruby test1.rb” or “test1.rb”. I
cannot find a shortcut (for example, just press F5 key or other keys)to
run the script directly from GVim.

Thanks,

Li


#12

Li Chen schrieb:

How do you run a Ruby script using Windows GVim? What I do is to write
a script with GVim, save it, then open a window prompt, CD to the folder
containing the script, and run it with “ruby test1.rb” or “test1.rb”. I
cannot find a shortcut (for example, just press F5 key or other keys)to
run the script directly from GVim.

Hi Li,

on RubyGarden there should be many infos about using Vim for Ruby
programming. You could start here:

http://wiki.rubygarden.org/Ruby/page/back_links/CategoryEditor

Happy holidays everybody,
Pit