How to debug ruby tasks on Rubymine
Lets do an example creating a new task
First create a task file in your rails project, for example:
touch lib/tasks/debug.rake
And add one task in this file:
namespace :debug do
desc 'Test rubymine debug feature'
task :something => :environment do
hello = 'world'
p hello
end
end
Now put a breakpoint on the line that we print the variable hello, and lets config the debugger.
To config the debugger, first go to menu "Run/Edit Configurations..." and add a new configuration using a rake template.
Now fill the first field with you task name.
And now you're ready to debug, you just need to click on the bug button with your task selected.
You can use the interactive console, see the traces and see the log console too.
It's a wonderful tool and you can use for solving problems in a "clean environment" and make sure your tasks works good.
Have fun!!!