Aptana Studio 3 中的远程调试 Rails 应用程序 [英] Remote debugging Rails application in Aptana Studio 3
问题描述
我的 Rails 开发 IDE 是 Aptana Studio 3.0.5,在 Windows 上运行.这些应用程序在单独的 CentOS Linux 机器上的 Apache + ModRails (Phusion Passenger) 上运行.我有 Rails 2.x 和 3.x 应用程序.
我希望能够在 Aptana Studio 中使用调试器(远程连接到正在运行的应用程序).显然有一些规定,但我无法弄清楚服务器端需要什么(在我的 Rails 应用程序配置中)
我已经试过了:
Using Rack::Debug: 它只创建unix socket,不能远程连接.
直接使用 ruby-debug:
我将此添加到我的
/config/environments/development.rb
:
<前>如果 File.exists?(File.join(RAILS_ROOT,'tmp', 'debug.txt'))需要红宝石调试"Debugger.wait_connection = trueDebugger.start_remote("real.hostname", 5000, 5001)File.delete(File.join(RAILS_ROOT,'tmp','debug.txt'))结尾
用 debugger
语句喷洒我的代码会停止执行,但我无法从 Aptana 连接到这个实例,不能连接到端口 5000 和端口 5001(我不明白为什么我需要两个端口那里).
此外,即使有效,这种方法也会相当缓慢且过于复杂,我想要一个更集成"的方法.调试.有可能吗?
Netbeans 的旧步骤相对接近,因为 Aptana/RadRails 和 Netbeans 共享相同的调试器核心:http://blogs.oracle.com/martink/entry/remote_debugging_debug_whatever_ruby
基本上,使用 rdebug-ide -p 7000
(或您想要的任何端口)运行 ruby 应用程序,然后在 IDE 中,转到运行 > 调试配置.在左侧,选择Remote Ruby Debug Session",然后在那里添加一个新配置(列表上方的加号图标).输入您在命令行中输入的正确主机 IP/名称和端口.
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?
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.
这篇关于Aptana Studio 3 中的远程调试 Rails 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!