开发者

Remote debugging Rails application in Aptana Studio 3

开发者 https://www.devze.com 2023-04-13 01:40 出处:网络
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 ap

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:

  1. Using Rack::Debug: It creates only unix socket, can开发者_如何学编程not be connected remotely.

  2. 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号