Netbeans and cygwin ruby don't have a happy relationship. To use the cygwin ruby interpreter it is necessary to launch Netbeans (6.1) with the arguments:
-J-Druby.no.sync-stdio=true
as otherwise Netbeans will pass a windows-style file name to the cygwin ruby that the latter cannot recognise (C:\Projects\Blah instead of /cygdrive/c/Projects/Blah). Unfortunately the ruby interpreter configuration in Netbeans tries to be clever and insists you point it to a ruby executable, you can't give it a batch file that will hack things into working shape.
rspec on cygwin has some similar problems. Here are some hacks to the rspec plugin to make it work from netbeans:
In vendor/plugins/rspec/bin/bin, change:
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
to
$LOAD_PATH.unshift(File.dirname(__FILE__).sub( /C:\//, '/cygdrive/c/') + "/../lib")
In vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb, change:
load file
to
load File.expand_path(file).gsub(/C:/, '/cygdrive/c')
Tip: to diagnose problems with 'require' not finding files, put this:
p $:
before the failing line to see what directories are in the load path. If you see 'C:\' and it's cygwin then fix it.
Unfortunately it takes a good 20 seconds for cygwin/rspec to run a trivial test script. The rspec server starts and runs but netbeans/rspec seem reluctant to use it (it runs tests ok from the command line).
Why am I still bothering with cygwin? Because I still want to test gcc C code by compiling it into ruby extensions and using ruby test codes (rspec or unit testing).
In tracing these problems I came across more reasons that Netbeans is worth the hassle:
- ctrl-tab to switch to last open tab. ctrl and hold tab brings up a handy little context menu to choose a tab from (kinda like windows task switching with tab).
- press ctrl and mouse over an identifier to bring up rdoc info about it. Ctrl-click to go to it's definition.
- alt-b to go back to where you came from.
- click on an 'end' and the matching begin/do/if is highlighted and vice versa, which is damn useful.
- select an identifier and all matching identifiers in your file are automatically highlighted.


