问题
My Rails development IDE is Aptana Studio 3.0.5, running on Windows. The applications runs on Apache + ModRails (Phusion Passenger) on a separate CentOS Linux machine. I have both Rails 2.x and 3.x applications.
I would like to be able to use the debugger in Aptana Studio (connect to the running application remotely). There are apparently some provisions for this, but I was unable to figure out what I need on the server side (in my Rails application configuration)
I've tried this:
Using Rack::Debug: It creates only unix socket, cannot be connected remotely.
Using ruby-debug directly:
I added this to my
/config/environments/development.rb
:
if File.exists?(File.join(RAILS_ROOT,'tmp', 'debug.txt')) require 'ruby-debug' Debugger.wait_connection = true Debugger.start_remote("real.hostname", 5000, 5001) File.delete(File.join(RAILS_ROOT,'tmp', 'debug.txt')) end
Sprinking my code with debugger
statements stop the execution, but I cannot connect to this instance from Aptana, not to port 5000 and not port 5001 (and I don't understand why I need two ports there).
Also, this method would be rather slow and too convoluted even if it worked, I'd like to have a more "integrated" debugging. Is it possible at all?
回答1:
The old steps for Netbeans are relatively close since Aptana/RadRails and Netbeans share the same debugger core: http://blogs.oracle.com/martink/entry/remote_debugging_debug_whatever_ruby
Basically, run the ruby app using rdebug-ide -p 7000
(or whatever port you want), then inside the IDE, go to Run > Debug configurations. On the left hand side, select "Remote Ruby Debug Session" and then add a new configuration there (the plus icon above the list). Enter the proper host IP/name and port you entered on the command line.
来源:https://stackoverflow.com/questions/7760722/remote-debugging-rails-application-in-aptana-studio-3