RubyMine debugger with Rake?

时光总嘲笑我的痴心妄想 提交于 2019-12-10 01:28:27

问题


Using RubyMine 3.0, I set up a Rake configuration to run a Unit Test. Then I set some breakpoints, then ran the Rake task. No breakpoints were hit, the test just executed like normal and then exited.

Does the RubyMine debugger not work through Rake?


回答1:


Try this:

  1. Go to Run -> Edit Configurations
  2. Expand the Rake node and add new rake configuration for your rake task (if not already done)
  3. Go to Run -> Debug...
  4. Select your configured rake task.



回答2:


The above answer is correct. I just want to elaborate on it a little bit, when using a mountable engine. In that case, I had to do the following:

  1. Run > Edit Configuration > Rake

  2. Enter task name e.g. scan_spreadsheet

  3. Change the working directory to your main application or dummy application, not the engine root directory.

  4. If you are using RVM with multiple gemsets, select the second option for Ruby SDK and select the correct gemset




回答3:


The Edit/Debug Configurations tab can be a littRuby Argumentsle confusing when setting up rake tasks. I will assume you followed this approach:

Run > Edit Configurations
Select Rake from the List and select the + button (Add New Configuration) 

You are greeted with a Configuration tab:

Name

The name attribute just assigns a unique name Ruby Argumentsfor this task. You can call it whatever you want.

Task Name

This one is important for rake tasks. This specifies the name of the rake task to be executed. So let's say you wanted to run "rake db:migrate" in debug mode, then for the task name here, you would put "db:migrate" without the quotes.

Turn on invoke/execute tracing, enable full backtrace (--trace)

This option is useful to turn on the standard rake --trace option.

Ruby Arguments

The other useful option is to specify the arguments to be passed to the Ruby interpreter.

Those are the main options. Now you can use Run > Debug and it will stop at breakpoints in the rake task itself.



来源:https://stackoverflow.com/questions/4401602/rubymine-debugger-with-rake

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!