Ruby Refactoring Plugin throws errors when refactoring Rails projects

I (very eagerly, I must say) downloaded and installed the Ruby Development Tools (RDT) Refactoring Support plugin a few days ago, after reading HÃ¥kan's and Jon's posts about it. It's pretty good, but the moment I tried it on Rails projects it would detect errors in unit_test.rb and worker.rb and all attempts at refactoring would fail with the error:

There is a syntax error in the document
\railsprojectdir\vendor\plugins\backgroundrb\generators\worker\templates\unit_test.rb, refactoring is not possible.

Turns out, both unit_test.rb and worker.rb actually contain templates and not ruby code.

I did log a bug at the RDT Refactoring Trac and the guys there very helpfully suppressed the error message - the fix is available in their Cruise build 567 - but the problem actually lies in the Rails code with templates having .rb extensions.

As a temporary fix I've renamed unit_test.rb and worker.rb to unit_test.rbt and worker.rbt and modified worker_generator.rb - which contains the code which uses the templates - to point to the renamed templates.

I guess I'll have to log a ticket at - but it seems to be down at the moment. Oh well...

No comments: