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应用程序配置中)需要什么
我已经尝试过了:
-
使用Rack :: Debug:它仅创建unix套接字,无法远程连接.
-
直接使用ruby-debug:
我将此添加到了
/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
用debugger
语句添加代码会停止执行,但是我无法从Aptana连接到该实例,不能连接到端口5000,而不是端口5001(而且我不明白为什么在那里需要两个端口).>
即使该方法有效,该方法也将相当慢并且太复杂,我希望有一个更集成"的方法.调试.可能吗?
由于Aptana/RadRails和Netbeans共享相同的调试器内核,因此NetBeans的旧步骤相对较近:调试配置".在左侧,选择远程Ruby调试会话",然后在此处添加新配置(列表上方的加号图标).在命令行中输入正确的主机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屋!