So to begin creating a gem using bundler use the bundle gem command like this.
Ruby create gem.
Bundler is a tool created by carl lerche yehuda katz andré arko and various superb contributors for managing rubygems dependencies in ruby libraries.
That one file is in charge of setting up your gem s code and api.
Ruby gems or gem is a package manager for the ruby programming language that provides a standard format for distributing ruby programs and libraries.
I ll admit that i was a bit intimidated the first time i tried to create a gem but i.
To publish our gem to rubygems we first need a rubygems account.
The convention is to have one ruby file with the same name as your gem since that gets loaded when require hola is run.
Bundler 1 0 was released around the same time as rails 3 and it s the rails project where bundler is probably most well known usage occurs.
You see gems everywhere in the ruby world.
We only need to login once rubygems stores our credentials in gem credentials to make the gem pushing.
How to create a ruby gem with bundler.
Here we will be creating a gem with bundler.
It just makes sure that you can see some output from the gem.
It does mirroring without any authentication and you can add your private gems in the gems directory.
If you need a simple application that makes it easy way to create your own rubygems mirror without having to push or write all gem you wanted in a configuration file try out gemirro.
There are two ways of pushing your gem.
So we will see the step by step process of how we can create a gem in ruby on rails.
Code for your package is placed within the lib directory.
Create an account if you dont have it already.
We re going to build a gem that generates a random greeting text along with the user s name e g.
The code inside of lib hola rb is pretty bare bones.
It is easy to manage and install to your system and it can be used by various rails applications.
Today i m going to show you how you can create and publish your very own ruby gem.
Now let s start with setting up our gem.
Finally after building the gem it s time to push the gem.
We could also use rake build for this that will create sequenceable 0 1 0 gem in pkg directory.
So here we go.