Manually updating rubygems
The other files for a gem are usually placed in a directory of the same name of the gem inside of directory for you, so end users don’t need to worry about configuring their load paths.
Let’s make a simple “hello world” gem, and feel free to play along at home!
The code for the gem we’re going to make here is up on Git Hub.
I started with just one Ruby file for my The gemspec defines what’s in the gem, who made it, and the version of the gem. All of the information you see on a gem page (like jekyll’s) comes from the gemspec.
% cat hola.gemspec Gem:: do |s| = 'hola' s.version = '0.0.0' = '2010-04-28' s.summary = "Hola!
" s.description = "A simple hello world gem" s.authors = ["Nick Quaranto"] s.email = '[email protected]' s.files = ["lib/hola.rb"] s.homepage = ' s.license = 'MIT' end Look familiar? After you have created a gemspec, you can build a gem from it.
The gemspec is also Ruby, so you can wrap scripts to generate the file names and bump the version number. Then you can install the generated gem locally to test it out.
Now you can share hola with the rest of the Ruby community.
Publishing your gem out to Ruby only takes one command, provided that you have an account on the site. Your browser will now try to download the file api_
To setup your computer with your Ruby Gems account: If you’re having problems with curl, Open SSL, or certificates, you might want to simply try entering the above URL in your browser’s address bar. Save it in ~/and call it ‘credentials’ In just a short time (usually less than a minute), your gem will be available for installation by anyone.