RubyMine and local gems

Hello,

When I'm attaching gem from a local path 'Find usages' functionality is not working for me. I tried options for all scopes - 'Project Files', 'Current File', etc, created a new scope. But when I remove my gem from Gemfile or detach it - everything works perfectly.

Just in case I attached a sample project that demonstrates the issue. Is there anything I'm missing in configuration or is it by design?



Attachment(s):
LibTest.zip
10 comments
Comment actions Permalink

It seems that some of the refactorings are broken as well. For example renaming of local variables or constants doesn't work.
BTW RM version 3.1.1 on Win 7.

0
Comment actions Permalink

Hello Vadim,

What kind of errors do you get with refactorings? We haven't recieved any reports yet.

Regards,
Oleg

0
Comment actions Permalink

Hi Oleg,

I attached two screenshots of problems I'm trying to solve. I develop a gem and RM attaches it to the project automatically.

find_usages.png
Find usages is not working when I have my custom developed gem (from local path) attached to the project (the source code is attached in my first message).

The second problem is that renaming functionality is not working in this case as well.

rename_constant.png
I'm trying to rename a constant, but RM cannot find all references of this constant in the code.

When I detach my gem from the project everything works fine. I think the problem is that RM considers that my gem is an external library and cannot use 'Project Files' scope to find references/usages, but any other scope doesn't work as well.

0
Comment actions Permalink

Hi all,

I have just downloaded the Vadim's test project and all of these issues have been reproduced by me.

Nothing happens when I'm trying to do 'Find Usages' and Refactor/Rename' feature works incorrectly.

I'm using RubyMine 3.1.1 #RM-103.260 on Mac OS 10.6.7 / Ruby 1.8.7-p174.

Find Usages:

find_usages.png

Refactror/Rename:

Step 1:
refactor_rename_step1.png

Step 2:

refactor_rename_step2.png

0
Comment actions Permalink



Hi Oleg,

It seems to me, that is a bug and it should be fixed ASAP.

Please look at my post.

0
Comment actions Permalink

As a workaround you can use gemspec call instead of gem 'lib_test', :path => './'

0
Comment actions Permalink

Hi Dennis,

Can you please explain a little bit more detailed what is the problem? The workaround is not really convenient. As I understand it's a bug. Do you know if it's going to be fixed?

Thanks.

0
Comment actions Permalink

BTW, when I applied suggested workaround RM started to show the following message on all 'require' statements: 'cannot find required file in attached gems'

gems.png

0
Comment actions Permalink

Thank you for submitting bug report. This happens because RubyMine treats your sources as both library(path-based gem which should not be refactored in general) and source code.
Problems with unresolved references are caused by http://youtrack.jetbrains.net/issue/RUBY-6858. And I don't see why gemspec call cannot be used instead of creating path gem dependency. It's official bundler way for developing gems

0
Comment actions Permalink

Thanks for explanation, Dennis.

0

Please sign in to leave a comment.