本文介绍了如何获得ruby-debug-ide的工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使ruby-debug-ide正常工作.我有一个基本的Rails应用程序,我想在RubyMine中进行调试.在甚至开始RubyMine之前,我需要在无所事事的VM中启用rdebug-ide.导航到项目目录时,我已经在线阅读了,我需要输入以下命令:

I can't get my ruby-debug-ide to work properly. I have a basic rails app, and I would like to debug in RubyMine. Before I even start RubyMine, I need to enable rdebug-ide in my vagrant VM. When I navigate to my project directory, I have read online I need to enter the following command:

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

但是,当我运行此命令时,会收到以下消息:

However when I run this command, I get this message:

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

I have also tried a modified version of the above command: (an extra dash)

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

我得到的结果是:起初看起来不错,但随后服务器永不启动.它从不显示服务器信息,它只是坐在这里并挂起,直到我按CTRL + C退出服务器.我无法使rdebug-ide与rails一起使用.有谁知道我该如何解决?

And I get this as a result:This looks good at first, but then the server never starts. It never displays the server info and it just sits here and hangs until I CTRL+C out of the server. I can't get the rdebug-ide to work in conjunction with rails. Does anyone know how I can fix this?

推荐答案

我已经进行了RubyMine远程调试:-)

I've got RubyMine remote debugging to work :-)

开始之前,请确保已安装debase和rdebug-ide:

Before you start, be sure you have debase and rdebug-ide installed:

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

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

1.启动Rails服务器

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

1. Start Rails server

First of all, you need to start the Rails server:

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版本是:

For your reference, my Ruby, Rails and Ubuntu versions are:

$ 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挂在那里等待连接.

As you noticed, the server seems never starting. It just hangs there. This is actually correct. It hangs there, waiting to be connected, from RubyMine for example.

现在启动RubyMine(我正在使用RubyMine 2017.2.4),运行->调试...->编辑配置...

Now start RubyMine (I'm using RubyMine 2017.2.4), Run -> Debug... -> Edit Configurations...

点击加号"+"以添加新配置,然后选择Ruby远程调试.

Click plus sign '+' to add new configuration, and choose Ruby remote debug.

填写表格,然后单击调试"按钮.立即服务器不再挂在那里,Rails服务器开始启动:

Fill the form and click the Debug button. Immediately the server does no longer hang there, and the Rails server gets started:

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中设置断点,并开始远程调试:-)

Finally, you can set breakpoints in RubyMine, and start remote debugging :-)

这篇关于如何获得ruby-debug-ide的工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 18:01