Publishing to

The simplest way to distribute a gem for public consumption is to use RubyGems. Gems that are published to RubyGems can be installed via the gem install command or through the use of tools such as Bundler.

Crear una cuenta en

To begin, you’ll need to create an account on Visit the sign up page and supply an email address that you control, a handle (username) and a password.

El " handle" que te solicita es tu nombre de usuario (loginname).


After creating the account, use your email and password when pushing the gem. (rubygems saves the credentials in ~/.gem/credentials for you so you only need to log in once.)

~]$ cat .gem/credentials 

gem build

Para construir la gema podemos usar:
[/tmp/tutu/my_gem]$ gem build my_gem.gemspec 
WARNING:  no homepage specified
  Successfully built RubyGem
  Name: my_gem
  Version: 0.0.1
  File: my_gem-0.0.1.gem

rake build

o bien podemos usar rake build. para contruir la gema.

gem push

To publish version 0.1.0 of a new gem named squid-utils:

$ gem push squid-utils-0.1.0.gem
Enter your credentials.

Don't have an account yet? Create one at
   Email:   gem_author@example
Signed in.
Pushing gem to
Successfully registered gem: squid-utils (0.1.0)
Congratulations! Your new gem is now ready for any ruby user in the world to install!

rake release

We can also use rake release:

[/tmp/tutu/my_gem]$ rake -T
rake build    # Build my_gem-0.0.1.gem into the pkg directory
rake install  # Build and install my_gem-0.0.1.gem into system gems
rake release  # Create tag v0.0.1 and build and push my_gem-0.0.1.gem to Rubygems

gem install: Instalar una gema

Para instalarla podemos hacer uso de gem install:

[/tmp/tutu/my_gem]$ gem install ./my_gem-0.0.1.gem 
Successfully installed my_gem-0.0.1
1 gem installed
o bien rake install.

gem uninstall: Desinstalar una gema

Para desinstalarla:

[/tmp/tutu]$ gem uninstall --force my_gem
Successfully uninstalled my_gem-0.0.1
[/tmp/tutu]$ pry
[1] pry(main)> require 'my_gem'
LoadError: cannot load such file -- my_gem
from /Users/casiano/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
[2] pry(main)>

Casiano Rodriguez León 2015-06-18