“The time has come…to talk of many [technologies].” –Lewis Carroll(‘The Walrus and the Carpenter’)
Develop Ruby Applications Using SciTE Editor
In the first and second parts of the series “Popular IDEs For Ruby Development”, I have mentioned two of the excellent IDEs available for developing Ruby applications:
1. Ruby Development With Eclipse IDE
2. Ruby Development With Komodo IDE
Though these IDEs boast of a large number of useful features to help developers achieve higher productivity levels, some people might find the very same features to be needless quirks that come in the way of the software development. For all the programmers who swear by the rich functionality provided by an IDE like Eclipse, an equal number of programmers feel more comfortable and more productive with simple but elegant, fast to load editors like Emacs and Vi. One such popular editor which has got inbuilt support for the Ruby programming language is SciTE. I will discuss Ruby program development with the SciTE editor in this post; Ruby development with Emacs and Vim will be the topic of the next post in this series.
SciTE is actually one of my favourite editors to develop Ruby programs. The reasons are very basic: it’s light-weight, it’s fast, it has out-of the box support for the Ruby language(no plugins as in Eclipse or editing modes as in Emacs are needed to be installed) and it runs on multiple platforms including Windows and GNU/Linux. It also has got excellent support for the other programming languages(more than 40!) like C/C++, Java, Perl, Python and PHP. And of course its free in every sense of the word.
Open the SciTE editor from the system menu or from the command line, create a new file and save the file with .rb extension; the editor will automatically switch to the Ruby mode and will do the appropriate syntax highlighting for the code. The Ruby language can also be explicitly selected for the program currently being edited, by selecting Language->Ruby menu item.

Once the editing is complete, the Ruby program can be executed by selecting the menu item Tools -> Go or by pressing the F5 key.

A new pane will be opened on the right side of the window to run the script and it will show if any errors are present in the program, or the output of the program otherwise.

Once all the errors in the program are fixed, pressing the F5 key will show the output of the program in the right pane.

With fast load times, support for syntax highlighting and code indentation, ruby interpreter and ruby interactive shell being supported from within the editor, SciTE provides an excellent environment for Ruby application development. It doesn’t end here though; SciTE also allows a lot of customisations to be done to the programming environment according to the tastes of the programmers. To affect the global settings of the editor that apply to the settings of all the programming languages(not just Ruby), select Options -> Open Global Options File menu item.

As an example, scroll down to around line 100(View -> Line Numbers to view the line numbers) and search for a property called “tabsize” and change it to 4(or whatever you prefer). Or scroll down roughly to the line number 300 and increase/decrease the font size by editing font.base property(under your platform):

Settings specific to the Ruby mode can be customised by going to Options -> Edit Properties -> Open ruby.properties.

You will see a similar list of properties that were present in the global properties file and the values of specific properties can be edited in the same way.

Ruby interactive shell can also be used from within the SciTE editor to test simple Ruby expression before using them in the programs. Just place the cursor in the right pane(output window; go to View -> Output if it is already not visible), type the command ‘irb’ and press the ENTER key. You will be dropped to an irb shell where you can experiment with various Ruby expressions.

I prefer to work with the SciTE editor(not just for Ruby) for various reasons pointed out earlier in this post. Most important of them all are that its available for both Windows and GNU/Linux(it looks and works the same way in both these OSes) and it supports most of the programming languages that I use. If you open a lot of different files for editing during one marathon editing session, you can save the state for later retrieval by saving and loading the sessions. The program files can also be exported to different document formats like PDF, RTF, HTML etc(from File -> Export menu). If you are searching for a light-weight, fast, multi-platform programming editor, then SciTE will be a great option to consider.
| Print article | This entry was posted by tabrez on August 29, 2006 at 10:15 pm, and is filed under GNU/Linux, Ruby/Rails. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 3 years ago
I am having few problems with SciTE (version 1.67).
- irb command is not recognized in the ouptut winodw
- can’ type anything in the DOS command window when it is opened via gets.
Any help?
Thanks, Mihail
about 3 years ago
Are you using SciTE under GNU/Linux or Windows?
Follow these steps:
Start the SciTE editor; go to View -> Output; in the output window, type the command ‘ri Kernel#gets’ and see what result it generates. What happens when you type the ‘irb’ command?
about 3 years ago
For both – “the system cannot find the file specified”.
When run them in a DOS Command Prompt both work – the path is set right.
I am confused…
about 3 years ago
i am having problems creating a program to remember what has been typed? it is basically creating your own “key logger,” any suggestions?
about 3 years ago
I think you may need to type irb.bat in the command window in you are running scite on windows
about 2 years ago
I have the same problem as Mihail,
To reiterate:
- irb command is not recognized in the ouptut winodw
- can’ type anything in the DOS command window when it is opened via gets.
I’m using Vista. I basically have to open the command prompt and run my programs from there when using Ruby.
about 2 years ago
Mihail, Jonathan:
irb.bat
ri.bat IO#read
Or you can create shortcuts to these commands. If you use these commands frequently, you can also create a menu item for them in “Tools” menu by adding the following lines to the Ruby properties file(Windows section only):
command.name.0.*.rb=irb
command.0.*.rb=irb.bat
command.is.filter.0.*.rb=1
command.0.subsystem.*.rb=1
You can now invoke irb from Tools -> irb or by pressing Ctrl-0 key combination. (Use another number instead of 0 if you have already bound Ctrl-0 to something else.)
To know more about what the above properties mean, refer to SciTE documentation from Help -> SciTE Help menu item.
Let me know how it goes. I will probably make a separate post to talk about the issues specific to Windows.
about 1 month ago
i have scite 2.12 on win7 ultimate : and two problem
1 – how we cancel pop up window (dos command black window ) when we press F5 to run?
2- when i use i.e. ” a=gets.chomp ” like code , scite output window not run step by step after F5. but it works in win dos window like ” c:/…..sample.rb ” i mean it is not run/print “puts” codes even its first line of the program. thanks…