简体   繁体   English

使用Pow作为服务器在RubyMine中进行调试 - Ruby 2.1.1 + Rails 4

[英]Debugging in RubyMine with Pow as a server - Ruby 2.1.1 + Rails 4

I have started using RubyMine 6. I am working on a Rails 4, Ruby 2.1.1 project. 我已经开始使用RubyMine 6.我正在开发一个Rails 4,Ruby 2.1.1项目。 I am not able to find how to debug into RubyMine with Pow as a server. 我无法找到如何使用Pow作为服务器调试RubyMine。

Can you please point me to the right direction? 你能指点我正确的方向吗?

I am able to debug from RubyMine using the remote debugging. 我可以使用远程调试从RubyMine进行调试。 I'm using RubyMine 6, Rails 3, Ruby 2.1.1. 我正在使用RubyMine 6,Rails 3,Ruby 2.1.1。

  1. First create a .powenv file and add: 首先创建一个.powenv文件并添加:

    export RUBY_DEBUG_PORT=1234 export RUBY_DEBUG_PORT = 1234

    export POW_WORKERS=1 export POW_WORKERS = 1

  2. Add the following gems to your Gemfile : 将以下gem添加到Gemfile

    gem 'ruby-debug-ide' 宝石'ruby-debug-ide'

    gem 'debase' 宝石'贬低'

  3. Create a new initializer start_debugger.rb and add the following content: 创建一个新的初始化程序start_debugger.rb并添加以下内容:

     if ENV['RUBY_DEBUG_PORT'] require 'ruby-debug-ide' Debugger.start_server nil, ENV['RUBY_DEBUG_PORT'].to_i end 
  4. Now in RubyMine you should be able to add a new run configuration using the default template for Ruby remote debug setting the local and remote folders to the root of your Rails app. 现在在RubyMine中,您应该能够使用Ruby remote debug的默认模板添加新的运行配置,将本地和远程文件夹设置为Rails应用程序的根目录。

  5. Now restart pow and attempt to connect. 现在重启pow并尝试连接。 You should see it connected in the debugger pane. 您应该在调试器窗格中看到它已连接。

Actually, you can just use Pow to proxy yourapp.dev domain to your localhost:3000 by 实际上,您可以使用Pow将yourapp.dev域代理到您的localhost:3000 by

echo 3000 > ~/.pow/yourapp

And then, access yourapp.dev and debug your app in Rubymine as normal 然后,正常访问yourapp.dev并在Rubymine中调试您的应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM