RubyMine and Gosu game development library

I admit I'm an almost total Ruby / RubyMine newbie, so maybe my expectations are out of whack here, but from what I have read this seems weird, and I could do with some feedback from more knowledgeable folks...

My environment:

  • OS X 10.6.8
  • Ruby 1.8.7
  • RubyMine 3.1 (and also tried with later versions just in case, right up 4.5)


I'm trying to play around with the Gosu game development library (http://www.libgosu.org/) and so to start with installed the corresponding gem with: sudo gem install gosu

That seems to have worked. I can follow along with their tutorial materials with no bother using vim and the programs I write run just fine. The thing that is puzzling me is that RubyMine doesn't seem to recognize this gem, or perhaps I misunderstand the extent to which it can recognize and offer support (e.g. autocomplete) for a gem.

For example...consider the following code:

require 'rubygems'
require 'gosu'


class Tutorial < Gosu::Window
  def initialize
    super( 640, 480, false )
    self.caption = "Gosu Tutorial Game"
    @background_image = Gosu::Image.new( self, "media/Space.png", true )
  end

end

This (and more) will run just fine (both from RubyMine or the command line). But the Gosu in Gosu::Window is underlined and the message when I hover over is "Cannot find Gosu".

Presumably because of this failure to recognize the Gosu::Window the caption in self.caption is underlined with the message upon hovering over of "Cannot find 'caption=' for type 'Tutorial'"

Lastly, when I try and instantiate the new image with Gosu::Image.new( self, "media/Space.png", true ) the Gosu of Gosu::Image is underlined again with a "Cannot find Gosu" message.


The gem is properly "attached" when I go look at Ruby SDK and Gems in Settings. I've tried detaching and reattaching a few times.

So I suppose my main question is, am I wrong to expect it to recognize Gosu, and have an understanding of inherited methods/properties that come from the Tutorial class extending Gosu::Window? Should it not be able to autocomplete identifiers from the Gosu library? I kind of imagine it should, but simply cannot seem to get it to do so.

Any explanation or suggestions would be very welcome!

Thanks,
Jon
4 comments
Comment actions Permalink

Hi Jon,

do you use bundler? And if yes then what do you have in your Gemfile?

Oleg.

0
Comment actions Permalink

Hi Oleg and thanks for your reply.

I don't believe bundler is involved -- I just created a new empty project, added a single "tutorial.rb", attached the gosu gem and started working.

Jon

0
Comment actions Permalink

I've filed a bug (http://youtrack.jetbrains.com/issue/RUBY-12000) about the problem.
It should be fixed in RM 4.5.4.
In mean time you can use bundler to workaround the problem.

Regards, Oleg.

0
Comment actions Permalink

Awesome, using Bundler seems to work. Thanks v. much!

0

Please sign in to leave a comment.