New user problems

I just downloaded RubyMine for the first time, coming from TextMate.  I'm having a bunch of issues just trying to get started.

First thing, I try to 'Open Directory'.  I step into one folder, step into another, step into another, BOOM it starts loading that folder.  What the heck?  Did I click something wrong?  OK so I hit 'Cancel' and 5 minutes later it hasn't stopped.  I have no choice but to force-kill it.  Why can't it use the regular old OSX file chooser like every other app?  It might prevent this kind of awkwardness.  So anyway, I tried it again, this time more carefully I suppose, and as I'm chasing I notice it's created some new random files for me already.  Crap!  Now I have to go and find the junk that RubyMine has created and kill it.  Then I finally go back to start loading my project, and after a minute or two it loads.

Now I see an error message, my RubyGems is out of date.  No, it's not out of date, you're just not loading the correct RubyGems.  Running 'which gem' returns '/opt/local/bin/gem'.  Running 'gem -v' returns 1.3.1.  Why is RubyMines saying I have an old version?

So now my project is loaded, I'm trying to ignore the error message for now.  I load up an rspec file, let's see if I can run it.  I click the Run button, and see again, Run Configuration Error: Rails gem isn't activated in Gem Manager for module 'my_project'.

OK that's a hint right?  So I click on it, nothing.  I go to the navigation menus... can't find anything.  I use the Help search... can't find anything.  OK now I'm frustrated.  By the way at this point I've noticed there's no support for running my spec suite.  I can't find any hints on how to do that out of the box.  Perhaps there's a way?

OK now I'm looking at a controller file.  I'm seeing lots of things underlined with 'cannot find' like the 'helper' command, and lots of other commands.  Is that normal?

On to a class file... I see "Company.new(:name => company_name)" underlined in red and it's telling me there's an error because .new takes 0 arguments, not 1.  Looking around more... wow, my class is flooded with 'cannot find' markers.  This code all works perfectly by the way.  What is going on here?

7 comments
Comment actions Permalink

Hello Glenn,

At first thank you for your feedback and time that you spent for it. Let me answer to your questions:

First thing, I try to 'Open Directory'.  I step into one folder, step into another, step into another, BOOM it starts loading that folder.  What the heck?  Did I click something wrong?

Double click or "Enter" automatically opens selected folder in files tree.

OK so I hit 'Cancel' and 5 minutes later it hasn't stopped.  I have no choice but to force-kill it.

Thanks, it's probably a bug. We will check it.

Why can't it use the regular old OSX file chooser like every other app?  It might prevent this kind of awkwardness.

We plan to improve "Open Directory" dialog. RubyMine is cross platform application and standard Java Open File dialogs don't work well on some OS. I agree with you that "Open Directory" dialog should be improved.

Now I see an error message, my RubyGems is out of date.  No, it's not out of date, you're just not loading the correct RubyGems.  Running 'which gem' returns '/opt/local/bin/gem'.  Running 'gem -v' returns 1.3.1.  Why is RubyMines saying I have an old version?

Each MacOS has bundled ruby framework(/usr/bin/ruby@ -> ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby). RM tries to detect Ruby framework from "PATH" env variable. But if you add "opt/local/bin" to your PATH variable in ~/.profile - MacOS will change PATH variable only for Terminal.app, other applications(including RubyMine) will use default path.
So you can select another Ruby interpreter in RM | File | Settings | Ruby SDK and Gems | Add SDK..

So now my project is loaded, I'm trying to ignore the error message for now.  I load up an rspec file, let's see if I can run it.  I click the Run button, and see again, Run Configuration Error: Rails gem isn't activated in Gem Manager for module 'my_project'.


OK that's a hint right?  So I click on it, nothing.  I go to the navigation menus... can't find anything.  I use the Help search... can't find anything.  OK now I'm frustrated.  By the way at this point I've noticed there's no support for running my spec suite.  I can't find any hints on how to do that out of the box.  Perhaps there's a way?

RubyMine attaches to RM's code insight only gems that are used in current project. Some gems RM detects automatically, other gems suggests to add as quick fix on "gem gem_name" command, or user may "attach" gem manually in File | Settings | Ruby SDK and Gems dialog. You can find information about RubyGems in our RM's Help:
RM | Help | Help Topics | Procedures | Configuring Projects | Managing Gems

As for RSpec - "rspec" (and "rspec-on-rails") gems should be attached in RM's Gems manager to enable RM's RSpec support (RM | Help | Help Topics | Procedures | Testing | Install Gems for Testing)

On to a class file... I see "Company.new(:name => company_name)" underlined in red and it's telling me there's an error because .new takes 0 arguments, not 1.  Looking around more... wow, my class is flooded with 'cannot find' markers.  This code all works perfectly by the way.  What is going on here?

Rails uses lots of hacks ("magic") to dynamically attach other scripts without "require" call, etc. If rspec/rails support isn't enabled/configured - RM consider your project as ordinary pure ruby. Obviously it's impossible to automatically understand all Rails dynamic but we continuously try to improve RubyMine code insight. Please show/report us code example with false positive and we will be able to fix RubyMine.

0
Comment actions Permalink

Each MacOS has bundled ruby framework(/usr/bin/ruby@ -> ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby). RM tries to detect Ruby framework from "PATH" env variable. But if you add "opt/local/bin" to your PATH variable in ~/.profile - MacOS will change PATH variable only for Terminal.app, other applications(including RubyMine) will use default path.
So you can select another Ruby interpreter in RM | File | Settings | Ruby SDK and Gems | Add SDK..

BTW Roman, Ruby installed on /opt/local (from MacPorts) is a very common scenario on OS X. Automatically trying to find an SDK in /opt/local would prevent this kind of confusion for many people.

0
Comment actions Permalink

I've already realized it =). I have another idea - we can look for ruby interpreter in PATH which specified in ~/.profile. As far as I understand people usually extend PATH env variable for console in this file(on MacOS).

0
Comment actions Permalink

I've already realized it =). I have another idea - we can look for ruby interpreter in PATH which specified in ~/.profile. As far as I understand people usually extend PATH env variable for console in this file(on MacOS).


That's a good idea! Just make sure you look for that interpreter in addition to the standard Ruby in OS X.

0
Comment actions Permalink

An easy quick fix for those who don't care about the existing OSX install is just to symlink /usr/bin/ruby to /opt/local/bin/ruby (or wherever):

$ sudo ln -fs /opt/local/bin/ruby /usr/bin/ruby

My real problem was that the default Rails .../script/spec file starts with #!/usr/bin/env ruby which detects the wrong ruby (/usr/bin/ruby) when I used RubyMine's Focused Spec Runner and therefore caused all sorts of havok.    Since I can't hardcode the path there (it's a common file in SCM shared across several development environments), I had to come up with this solution.

It looks like there may be other solutions, but this was easy & worked for me.  RubyMine guys - will RUBY-3945 solution fix this as well?  I'm a little surprised you don't just allow overriding the PATH in the Ruby on Rails IDE settings pane - why not..?

0
Comment actions Permalink

Bruce,

An easy quick fix for those who don't care about the existing OSX install is just to symlink /usr/bin/ruby to /opt/local/bin/ruby (or wherever):


$ sudo ln -fs /opt/local/bin/ruby /usr/bin/ruby

You shouldn't use such complicated solution. You should just manually add Ruby SDK in RubyMine settings: RM | File | Settings | RubySDK and Gems | Addd Sdk...
After it RubyMine will be able to work with /opt/local/bin/ruby interpreter.

My real problem was that the default Rails .../script/spec file starts with #!/usr/bin/env ruby which detects the wrong ruby (/usr/bin/ruby) when I used RubyMine's Focused Spec Runner and therefore caused all sorts of havok.  :(  Since I can't hardcode the path there (it's a common file in SCM shared across several development environments), I had to come up with this solution.

RubyMine always run tests and ruby scripts using ruby interpreter which is chosen in RubySDK and Gems settings. E.g. RM will execute
/opt/local/bin/ruby ./script/spec instead of "./script/spec". Please provide more details for your use case.

This temporary doesn't work only for Rails Console because rails executes irb command using PATH, instead of current ruby bin directory - seehttp://www.jetbrains.net/devnet/thread/281590?tstart=0 post.

I'm a little surprised you don't just allow overriding the PATH in the Ruby on Rails IDE settings pane - why not..?

We weren't sure that is really necessary (as far as I know no one asked about such feature for IntelliJ IDEA). Also each RubyMine's Run Configuration allow to modify ENV as you wish:
Picture 13.png

0

Please sign in to leave a comment.