Axel
9/22/2007 10:36:00 AM
My previous post seems to be lost :(.
The following instruction is quite old, and I'm not sure if
everything is up to date. I'm using jEdit for Ruby-editing
a lot and like it very much (I'm on Windows). And what you
ask for, works for me, both on jEdit 4.2 and 4.3pre9.
Please ask again, if the following Instruction does not
lead to success.
Kind regards,
Axel
Running Ruby from within jEdit
===============================
If you want to run a Ruby-file from within
jEdit by just pressing for example "F5", you can try:
Edit the file Run_Script.bsh" as follows:
(You will find it here:
In jEdit goto Utilies > jEdit Home Directory >
Macros > Misc > Run_Script.bsh )
Behind: path = buffer.getPath() + " ";
Add: bufferDir = dirname( buffer.getPath() );
Behind:
else if(mode.equals("python")) {
execScript("python", "python " + path);
}
Add:
else if(mode.equals("ruby")) {
execScript("ruby", "ruby -w " + path);
// or without showing warnings:
// execScript("ruby", "ruby " + path);
}
In jEdit: Utilities > Global Options > Edit Shortcuts:
"Macros" > Command: "Run Script" > Click into the field
"Alternative
Shortcuts" > Press the F5-Button > OK > OK
When now pressing "F5" on an open Ruby-file, it will/should be
executed; of course, you must have Ruby installed;
OPTIONAL, but very handy: Install the Plugin "ErrorList"
and the Plugin "Console".
If You choose to do so, maybe you want to adjust the "Error
patterns"; but try first without changing them, because
even my "Error patterns" are not perfect. (Does anybody
have a better set of error patterns for Ruby??):
jEdit > Plugins > Plugins Options... > Console >
Error Patterns > Ruby >
Name: Ruby
Regexp: \s+from\s(.:[^:]+)\s*:(\d+):?(.*)
Warning regexp: leave empty
Extra lines regexp: leave empty
Filename: $1
Line number: $2
Error message: <-- from here. $3
(On jEdit 4.3, not jEdit 4.2. you must enter a test string
and press a test/check(?) - button now.)
Now: > OK > OK
When now pressing "F5" on an open Ruby-file, it will be
executed; of course, you must have Ruby installed; Errors
are shown by the ErrorList-Plugin, and when clicking on
those errors, jEdit jumps to the relevant line in the
sourcecode.