Rake tasks not available in RubyMine

I have installed the RubyMine evaluation and it's reporting an error getting the list of Rake tasks.  

Error:

[rake --tasks] rake aborted!
uninitialized constant Rake::DSL
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'
<Rest of stack omitted>



I saw some reports that suggest rake 0.8.7 has an issue like this so I updated my gemset to use rake 0.9.2.  Unfortunately the RubyMine error shows that rake is being called from the main ruby directory rather than the gemset directory.
Here is the output showing the rake that is used when I call it from the Terminal:

hips:sample_app kennbrodhagen$ which rake
/usr/local/rvm/gems/ruby-1.9.2-p180@sample_app/bin/rake



Any suggestions on how I can get RubyMine to use rake from the gemset directory or another way to get RubyMine past the rake error?


Version Information:
MacOSX 10.6.8
RubyMine 3.1.1
Ruby 1.9.2 p180


Thanks!

-Kenn
0
15 comments

Sorry forgot to show the first line of the RubyMine error that shows it is calling rake from the main ruby-1.9.2-p180 directory instead of the gemset directory:
/usr/local/rvm/rubies/ruby-1.9.2-p180/bin/rake

0

And do you have "rake" executable in gemset dir bin folder? I suppose "rake" gem is installed in shared global gemset so RubyMine chose such path.

rake --tasks] rake aborted!
uninitialized constant Rake::DSL
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'
<Rest of stack omitted>


Looks like rake problem, could you launch "rake --tasks" from console? Please don't forgot to choose correct rvm sdk and gemset.

0

Is RubyMine able to use the rake from the rvm gemset or does it only use the rake that is in the global gemset?
There is a problem with Rake 0.8.7 that is in the global gemset but that is resolved with the version installed to my project's local gemset.

Do I need to resolve it by fixing rake in the global gemset or by getting RubyMine to use the local gemset?

0

I have a similar problem. I guess RubyMine is not using "bundle exec rake ..." for fetching the rake task list even when it's configured in Run > Edit Configuration > Rake.

[rake --tasks] rake aborted!
You have already activated rake 0.9.2, but your Gemfile requires rake 0.8.7. Consider using bundle exec.
/Users/me/.rvm/gems/ruby-1.9.2-p180-patched@xtwocloud/gems/bundler-1.0.15/lib/bundler/runtime.rb:31:in `block in setup'

bundle exec rake -T is working in console.

1

Here is the output of rake --tasks.  I have added my comments after the #

# first check the path to rake in my sample app folder.  This shows it's using the gemset for my project.

hips:sample_app kennbrodhagen$ which rake
/usr/local/rvm/gems/ruby-1.9.2-p180@sample_app/bin/rake

# check the version of rake

hips:sample_app kennbrodhagen$ rake --version
rake, version 0.9.2



# now run rake --tasks.  I did not include the full output to save space but it does list all the tasks in my project

hips:sample_app kennbrodhagen$ rake --tasks
WARNING: Global access to Rake DSL methods is deprecated.  Please include
    ...  Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method SampleApp::Application#task called at /usr/local/rvm/gems/ruby-1.9.2-p180@sample_app/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks'
rake about              # List versions of all Rails frameworks and the environment
rake db:create          # Create the database from config/database.yml for the current Rails.env (use db:create:all to create all dbs in the config)
rake db:drop            # Drops the database for the current Rails.env (use db:drop:all to drop all databases)
rake db:fixtures:load   # Load fixtures into the current environment's database.
...
0

RubyMine 3.2.1 solves the issue!  I upgraded today and now rake tasks are available.  

0

The problem is still existing in 1.9.2:

$ rake -T
rake aborted!
You have already activated rake 0.9.2, but your Gemfile requires rake 0.8.7. Consider using bundle exec.

(See full trace by running task with --trace)
$ bundle exec rake -T
rake about                               # List versions of all Rails frameworks and the environment
rake cucumber                            # Alias for cucumber:ok
...
rake tmp:create                          # Creates tmp directories for sessions, cache, sockets, and pids
Loaded suite /Users/stahn/.rvm/gems/ruby-1.9.2-p180-patched@xtwocloud/bin/rake

0

I got the error you did at one point, too.  I'm pretty sure I tried the "bundle update" command suggested on this Stack Overflow post and it resolved the error for me.  

http://stackoverflow.com/questions/6317980/bundle-rake-error

0

Dear Kenn,

thanks for your response. I know the source of the problem (loading rake) and I know that you can just update every dependency until everything works fine again. However sometimes you just can't freely update all gems.

In my point of view this is a bug/missing feature in RubyMine. Why RubyMine fetches the rake task list with "rake" instead of "bundle exec rake"? Bundler will take care of the gems and it doesn't matter whether you have installed multiple rake versions.

That's what the examples in my previous post should have demonstrate.

Enrico

0

Is this issue planning on being resolved? I have a few applications that need to use rake 0.8.7 and when using RubyMine v3.2.3 and running Rake Tasks->Reload rake tasks it tries to simply run rake -T from the command line rather than bundle exec rake -T.

0

Hi Kenn,

Sorry for a long time to reply I was on vacations. Is the problem still actual? If yes, could you add diagnostic info from RubyMine | Tools | Show Gem Environement dialog?

0

Yes, I want to fix it in next RubyMine 3.x update, please track issue http://youtrack.jetbrains.net/issue/RUBY-8987

0

Hi all, I was able to get my Rake tasks back and running with the following workaround:
Go to Preferences/Settings, and in Ruby SDK and Gems, check "ignore global gempath."  
Then refresh Rake tasks.
HTH and stuff.

0

Hi Shannon,

Instead you can uninstall rake gem from "global" gemset. RVM automatically configures "global" gemset which gems are shared among other gemsets. By default rake gem is preinstalled there. We've fixed the issue in RubyMine 4.0. EAP progam will be available soon.

0

Thank you for the added note; I should have specified also that I am using RVM so in my case ignoring global gemset is fine.

0

Please sign in to leave a comment.