开发者

RubyMine debugger with Rake?

开发者 https://www.devze.com 2023-01-30 07:07 出处:网络
Using RubyMine 3.0, I开发者_JAVA百科 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 an

Using RubyMine 3.0, I开发者_JAVA百科 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?


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.


The Edit/Debug Configurations tab can be a little 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 for 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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消