ScITE Question

I’m a newbie & am just learning to use Ruby. I’ve chosen ScITE as my
editor. So far so good, writing scripts then executing them inside
ScITE using ‘F5’.

when I run this in ScITE

puts “Hello, world. What is your name?”
myname = gets()
puts "Well, hello there " + myname + “.”

All that happens is the ruby.exe window pops up & sits there blank.

If I name the above script “banana1.rb”, save it to C:\rubyprograms

& then run the program from the command prompt it runs fine.

eg:

c:\rubyprograms> ruby banana1.rb
Hello, world. What is your name?"
OneBanana
Well, hello there OneBanana

Why won’t it run in ScITE?

Thanks in advance.

Have you asked here: http://groups.google.com/group/scite-interest

Not yet, I joined last night & have just been accepted. Will try there
now, thanks, Steve.

SciTE is a wonderful ide, unfortunately it does not take well to input
in its output panel. While the output panel can handle plenty of shell
commands, in general it was not implemented in SciTE to handle many
input situations, not just the ones that ruby presents.

After spending many cumulative hours searching for a fix or workaround
and being left without even a hint on how to make it work, I decided
to create my own workaround. What the below does is launches an xterm
for your input and output, but if ruby has an error, its sent to Scite
so you can use the line highlight feature.

In windows you’ll have to find your own solution, but in linux you can
do the following:

  1. First off we need to change the command that launches ruby. Using
    the SciTe Menu
    Options->Edit Properties->Open ruby.properties

You will see the lines near the bottom:

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

change the command.go to:
-=-=-=-=-=-=-=-=-
command.go.*.rb=xterm -hold -e /usr/bin/sciteredirection_for_ruby.sh $
(FileNameExt)
=-=-=-=-=-=-=-=-=

  1. then save and chmod 755 the following shell script to /usr/bin/
    sciteredirection_for_ruby.sh

=-=-=-=-=
#! /bin/bash
ruby $1 2> /proc/$PPID/fd/2
=-=-=-=-=

I use xterm instead of konsole or other terminals because SciTE gets
the exit code immediately after closing, and xterm shuts off input
after ruby terminates.

If anybody knows a more cross-platform solution, can patch the SciTE
code itself, or even knows a better way to do the above, I’d like to
know.