Ruby Gems Starter Guide nov 9, 2015

This week, I gave a talk on the Ruby programming language at RocHack, and the prominent software distribution system that Ruby uses (RubyGems). More solid references for getting started with Ruby:

Some notes from the presentation: The creator of Ruby is Matz. He designed the language so that it would be enjoyable to program in. Specifically, it has a concise, flexible interface, along with a very positive community (although there does seem to some dissent as well). RubyGems hosts Ruby libraries, called gems. Gems are optimized to be super-portable, make versioning code easy, and best of all they are totally free to use (both for downloading and installing code, or uploading gems that you made)!

gem setup tips

On cycle servers, install into ~/bin, avoiding the need to use sudo. Note that once you do this, you will have to add this folder to your shell’s path. Make this the default when installing gems by running with the two commands down below. This will create a bin folder in your home directory, and set the default the gem installation location to this folder:

cd && mkdir bin
echo 'gem: -n~/bin/' >> $HOME/.gemrc

On OSX, the default ruby/gem version needs root access to be modified. Options:

Try to install a gem, and see if it works:

gem install tv.rb
tv.rb --wavy pride

There should be a rainbow in your terminal. Press Control-C to stop!

writing a gem

Here is a good example of a simple Ruby gem: (qrush/hola). Initially, there may seem like there are a bunch of random files. Each has their place and purpose, though. Here is a brief description of each file/folder you may see in a standard gem:

More help on building your first gem found here, and here are the full presentation slides. Thanks to everyone who came out and listened to me rant about Ruby!

all next