Ruby and SciTE

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

Subject: Ruby and SciTE
Date: Mon 12 Nov 12 04:58:09AM +0900

Quoting Daniela R. ([email protected]):

… 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 .rb

or write

ruby //.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

Am Mon, 12 Nov 2012 04:58:09 +0900
schrieb Daniela R. [email protected]:

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs