Launching external tools from radrails (without using the internal console window)

I am a windows rails developer, and I love rad-rails. However, it has a big gap when it comes to debugging features. But, when using the ruby-debug gem in tandem with the external tools feature of rad-rails (eclipse), debugging can become surprisingly pleasant. In this article I will show you how to set up various “External Tools” shortcuts to aid you debug rails applications (and do other things).

Why not use the internal console window in rad-rails?

The internal console window has issues. Namely, when you input a character, the console sends the character twice, which is very intrusive when using the debug command line.

Lets get started

To begin, open up a project in rad rails. Then, click the external tools icon, and select “External Tools”.
Step 1

Click the “new launch configuration” icon in the dialog that appears. Fill in the fields as follows:

  • Location: c:\windows\system32\cmd.exe
  • Working Directory: ${project_loc}
  • Arguments: /C start ruby ${project_loc}/script/console

Step 2

Then, click the environments tag. Add your rails environment variable, click OK.

step 3

Finally, disable allocation of a console for input.

step 4

Click close and you’re done!

Now, any time you want to want to start an external rails console, open a project, click your external tool, and

step 5

step 6

Other Configurations

To create other external tools, duplicate your external rails console launch configuration that you created:
how to duplicate

Then, change the first page to the following (you can keep the rest of the tabs the same, since they will have been copied from the previous configuration)

Launch mongrel

  • Arguments: /C start mongrel_rails start

Run test cases for current focused file only

(this is very handy for debugging)

  • Arguments: /C start c:/ruby/bin/run_pause.bat c:/ruby/bin/ruby -Ilib;test “c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb” ..${resource_path}

Then, create the file c:\ruby\bin\run_pause.bat:

@echo off
cmd /C %*

Running a test case this way is very handy for debugging test cases! (it saves you a lot of time not having to run all of the other test cases).

Your path for rake_test_loader.rb may very. If it does, make sure update the path from what I gave you

The possibilities are basically limitless! Happy external-launching!



Be the first to leave a comment on this post.

Leave a comment

To leave a comment, please log in / sign up