views:

232

answers:

3

I've developed a Ruby application (a small game), and I would like to 'distribute' it to other people.

However, I am not sure what to do about the required gems. If I just send my application to someone who have ruby installed, but not the required gems, I assume it will blow up. Can I package the gems locally? If so, would it conflict if the other person has a different version of the gem?

So, what is the smart/proper/good way of doing this?

+4  A: 

The best way would probably be to just package your game as a gem as well, that way rubygems will take care of installing the dependencies. Here's the documentation explaining how to create your own gems.

sepp2k
That's the way to do it. If you've never done it before, jeweler[1] should be of help. You can also specify your gem's dependencies in your gem's manifest.[1] - http://github.com/technicalpickles/jeweler
hgimenez
And by the way, you can create a rake task that can install your gems. See Yehuda's answer here: http://stackoverflow.com/questions/1000749/how-to-quickly-initialize-ruby-project-development-environment/1072299#1072299
hgimenez
That's a good point! I haven't thought about making the game as a Gem.
pschneider
+3  A: 

If you'd rather not package your game as a gem, you could investigate the Bundler, which will be integrated into Rails 3.

Greg Campbell
+1  A: 

In your environment.rb you can express your gem dependencies, eg.

  config.gem "activemerchant", :lib => "active_merchant", :version => "1.4.1"

This isn't as automatic as gem dependencies, but it certainly usable. User must sudo rake gems:install to get your app to start.

ndp