Forum: Ruby Ruby and SciTE

Posted by Daniela Robles (Guest)
on 2012-11-11 20:58
(Received via mailing list)
Hi all,

Ruby no longer comes together with SciTE, so I had to download the SciTE
text editor separately. However, I find that Ruby and ScITE do not work
together. The command line in Ruby won't run or find any programs that I
create with the text editor. How do I get them to work together? Or how 
do
I get Ruby to find and locate programs and scripts I write with SciTE?

FYI, I'm a programming newbie.

-Dani
Posted by Carlo E. Prelz (Guest)
on 2012-11-11 21:11
(Received via mailing list)
Subject: Ruby and SciTE
  Date: Mon 12 Nov 12 04:58:09AM +0900

Quoting Daniela Robles (daniela.robles15@gmail.com):

> ... Or how do
> I get Ruby to find and locate programs and scripts I write with SciTE?

I do not know anything about SciTE, but command-line Ruby expects you
to pass it the path of your script. You either have to be in the same
directory of your script, and, from the command line, write

ruby <whatever>.rb

or write

ruby /<path>/<whatever>.rb

Do you know where your files are saved? Can you see them? From your
editor, you should be able to specify the file name...

Maybe you can contact the developers of that editor.

Carlo
Posted by Marvin Gülker (quintus)
on 2012-11-12 00:32
Attachment: signature.asc (489 Bytes)
(Received via mailing list)
Am Mon, 12 Nov 2012 04:58:09 +0900
schrieb Daniela Robles <daniela.robles15@gmail.com>:

> Hi all,

Hi Daniela,

> Ruby no longer comes together with SciTE, so I had to download the
> SciTE text editor separately. However, I find that Ruby and ScITE do
> not work together. The command line in Ruby won't run or find any
> programs that I create with the text editor. How do I get them to
> work together? Or how do I get Ruby to find and locate programs and
> scripts I write with SciTE?

In order to run scripts, SciTE executes Ruby as an external process.
The exact command it uses is defined in the ruby.properties file (click
"Options" -> "Edit properties" -> "ruby.properties") via the
configuration option "command.go.*.rb". This option is automatically
set depending on your platform (i.e. the PLAT_WIN block is used for
Windows, PLAT_MAC for Mac OS, ...). Assuming you’re using Windows, the
default command that comes with SciTE looks like this:

  command.go.*.rb=ruby $(FileNameExt)

$(FileNamExt) is replaced by the full absolute path to the file
currently being edited. Note this command makes two non-trivial
assumptions:

1. The "ruby" program must be somewhere in your PATH. If you used the
   RubyInstaller, it probably is. If it isn’t SciTE will report
   some command-not-found error.
2. The file you’re editing is in a directory whose path doesn’t contain
   spaces. $(FileNameExt) doesn’t take care of escaping spaces, and they
   are then interpreted by CMD when SciTE executes that command,
   stashing the command to rubbish. This is especially an issue on
   Windows XP where the default user’s home directory contains already
   spaces as it’s located under "C:\Documents and Settings".

To resolve 1) if not already, you must add the bin/ directory of your
Ruby installation to your PATH variable. To resolve 2), simply change
the above configuration option to this:

  command.go.*.rb=ruby "$(FileNameExt)"

Quoting the filename will prevent CMD from interpreting the spaces in
the filename and make it take it as a whole and pass it on to Ruby as a
single argument as Ruby expects it.

Of course you could also just skip 2) and use ruby directly from the
command prompt.

> FYI, I'm a programming newbie.
>
> -Dani

You’re welcome.

Valete,
Marvin
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.