Ruby gem tips

Previous | Next

Tips for developing Ruby gems:

  • Add this at the top of exe/gem_name:
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require 'gem_name'

this will include the most recent version of the gem, which is great for quick trail-and-error development. Without updating $LOAD_PATH I'd need to build and install the gem every time I made a change, which is a slow process.

  • Run this command to check if a gem is available for registration:
gem search -e gem_name

if the output is empty, you're in luck and should hurry to register the gem before some one takes it!