我有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远程调试。
填写表格,然后点击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的设置断点,并启动远程调试:-)
您使用的是从流浪汉固定IP配置?如果不确定转发您使用的端口(1236),以便主机可以侦听此端口 –