1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Creating and Distributing Gems with Bundler

By

6 of 6

Install or Publish the Gem
Creating and Distributing Gems with Bundler

Once you've written some code, go ahead and make a package by running rake build. This will package the gem up in a .gem file in the pkg directory. While there's little that can go wrong here, do this at least once to see what it does. It's not very useful though, unless you'll be deploying this to another repository some other way.

If you'd rather install the gem, run rake install. This will install the gem on your system. If you're the only one using the code, this is the simplest solution. However, there's much more magic to be done if you're publishing with RubyGems and Github.

If you have a Rubygems account set up, and a Github external set up in the gem's repository, the rake release command is the most useful. First, make sure you've increased the version number of your gem and run git commit. Next, run rake release. This Rake task will make sure you've committed and there isn't already a tag with this version name. It will then build the gem into the pkg directory, push to Github, and then push to RubyGems. It couldn't be any easier.

  1. About.com
  2. Technology
  3. Ruby
  4. Advanced Ruby
  5. Install or Publish the Gem

©2014 About.com. All rights reserved.