- Read Tutorial
- Watch Guide Video
In this lesson, I'm going to show you how to research RubyGems. The main repository for gems can be found at rubygems.org.
On this site you can find all kinds of gems. Additionally you can use places like github to find new gems. However it is considered a best practice to get gems from RubyGems
because the site has the most up to date gem and version. There are times when developers forget to update their GitHub repositories, which can result in version conflicts.
How to Research Gems
To get started I'm going to search for a gem called pundit
.
This will bring up the search results for you.
If you click on the first link, it will take you to a page that has all the information needed to research the gem.
You can see how popular a gem is by looking at the number of times it has been downloaded. Also, this page shows the number of times that a particular version was downloaded, which is important when you're analyzing different gem versions. Just below the download stats you can see the code that you can paste into your application. When you use the RubyGems site this code also comes with the stable version number embedded in the code itself, which is quite helpful.
If you look in the middle of the page you can see the full list of outside dependencies that the gem has. What this means is when you install pundit
, it will install all of these dependencies too. Knowing this information is important since because sometimes you'll run into a situation where a gem has a conflict with another gem and the cause of the issue was one of the dependencies. For example, if you bring in the will_paginate gem, there may be a conflict with Rails admin (this is something I've run into on several occasions).
If you scroll down the page, you can see some links on the right hand bottom side. The most important link is the homepage
as it takes you to the corresponding gem page, which is usually on GitHubt
. This link contains information on how to install and use the particular gem.
Other than this, this page has information about past versions, contributors and other information that may be helpful.