Ruby Gems or “gem” is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries. It is easy to manage and install to your system and it can be used by various rails applications.
Every RoR developer might have customised a gem at least once in his career, but not each one of them has actually, created a gem. Here, I am going to give a basic idea about how to create a new gem and how to publish it.
Kick off
Before starting please make sure that you are using the latest ruby version. RVM is really useful in this case;
How to name your Gem
Don’t blindly give a random name to your gem. Please take care of the following;
Every dash represents a structure (folder, module) immersion
Every underscore represents a joining in the class name
Some examples:
gem new_test_gem
- require ‘new_test_gem’
- module/class NewTestGem
- require ‘gem/structure/new_test_gem
- module/class Gem::Structure::NewTestGem
- A gem version is a string of 3 numbers – ‘X.Y.Z’.
- Incrementing X, Y, Z
LUBAIB CEEJEY
Sr. Ruby on Rails Developer
Subscribe For Latest Updates
Related Posts