2015-09-17 49 views
1

我无法让我的ruby-debug-ide正常工作。我有一个基本的rails应用程序,我想用RubyMine进行调试。在我启动RubyMine之前,我需要在我的流浪虚拟机中启用rdebug-ide。当我浏览到我的项目目录,我看了网上我需要输入以下命令:如何让ruby-debug-ide工作?

rdebug-ide --port 1236 --dispatcher-port 26166 --host 0.0.0.0 - bin/rails s -b 0.0.0.0 

然而,当我运行此命令时,我得到这个消息: enter image description here

我也尝试了上述命令的修改版本:(额外破折号)

rdebug-ide --port 1236 --dispatcher-port 26166 --host 0.0.0.0 -- bin/rails s -b 0.0.0.0 

而且我得到这个结果: enter image description here 这看起来不错,在杉木st,但是服务器永远不会启动。它从不显示服务器信息,它只是坐在这里并挂起,直到我将CTRL + C移出服务器。我无法使rdebug-ide与rails结合使用。有谁知道我该如何解决这个问题?

+0

您使用的是从流浪汉固定IP配置?如果不确定转发您使用的端口(1236),以便主机可以侦听此端口 –

回答

0

我相信你应该把命令添加到RubyMine里面的Ruby远程调试配置中。

Run > Edit Configurations > Add Ruby remote debug配置。

0

我有RubyMine的远程调试:-)

工作开始之前,请确保您有贬低和安装中,RDebug-IDE:

gem list | grep debase  
gem list | grep ruby-debug-ide 

sudo gem install debase 
sudo gem install ruby-debug-ide 

1.启动Rails的服务器

所有的

首先,你需要启动Rails服务器:

hello_rails$ rdebug-ide --host 0.0.0.0 --port 1234 --dispatcher-port 26162 -- bin/rails server 
Fast Debugger (ruby-debug-ide 0.6.0, debase 0.2.2.beta10, file filtering is supported) listens on 0.0.0.0:1234 

供您参考,我Ruby,Rails和Ubuntu的版本是:

$ ruby -v 
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux-gnu] 

$ rails -v 
Rails 5.1.4 

$ lsb_release -a 
Description: Ubuntu 16.04.3 LTS 
Codename:  xenial 

正如你所看到的,服务器似乎从来没有开始。它只是挂在那里。这实际上是正确的。它挂在那里,等待着从RubyMine连接,例如。从RubyMine的

2.远程调试

现在启动的RubyMine(我使用的RubyMine 2017年2月4日),运行 - >调试 - >编辑配置...

点击加号“ +'来添加新配置,并选择Ruby远程调试。

enter image description here

填写表格,然后点击Debug按钮。马上服务器也不再挂在那里,和Rails服务器得到启动:

hello_rails$ rdebug-ide --host 0.0.0.0 --port 1234 --dispatcher-port 26162 -- bin/rails server 
Fast Debugger (ruby-debug-ide 0.6.0, debase 0.2.2.beta10, file filtering is supported) listens on 0.0.0.0:1234 
WARN: Unresolved specs during Gem::Specification.reset: 
     rake (>= 0.8.1) 
WARN: Clearing out unresolved specs. 
Please report a bug if this causes problems. 
=> Booting Puma 
=> Rails 5.1.4 application starting in development 
=> Run `rails server -h` for more startup options 
Puma starting in single mode... 
* Version 3.10.0 (ruby 2.4.2-p198), codename: Russell's Teapot 
* Min threads: 5, max threads: 5 
* Environment: development 
* Listening on tcp://0.0.0.0:3000 

最后,你可以在RubyMine的设置断点,并启动远程调试:-)