Home » Ruby programming

Ruby Gems | Ruby Tools

Ruby Gems: Here, we are going to learn about the Ruby Gems, structure of Ruby Gems, using Ruby Gems, installing & uninstalling Ruby Gems, etc.
Submitted by Hrithik Chandra Prasad, on August 21, 2019

Ruby Gems

Every language has its package manager which helps it by providing libraries and a standard format to distribute Ruby program. It is a type of tool which is developed to easily facilitate the installation of Gems. The command-line tool is the interface used by Ruby gems which provide service in installing and managing libraries.

Structure of Gems

Every gem is identical by a version, platform and obviously, a name. The architecture of CPU, Type of Operating System and version are few of the factors which decide the working criteria of Gem.

Each gem comprises of:

  • Documentation
  • Code
  • Gemspec i.e. Gem specification

The organisation of code follows the structure which is mentioned below:

Ruby Gems | Ruby Tools

Now let us understand each term in a single line.

  • The bin directory contains the binary file.
  • The code for the gem is being stored by lib directory.
  • The testing is conducted by the test directory.
  • Generation of code and automation of test id done by Rake which used Rakefile.
  • README simply comprises documentation for most of the gems.
  • Information like the purpose of the gem, the time gem was created, author gem belongs to, is contained by Gem specification also known as gemspec.

Using Gems

Gem contains files to install along with package information. The practice of building gems directly is known as Rake. The gems are generally built from ".gemspec" files. Let us understand the following gem commands for various purposes listed below:

For installation, type the following in the terminal,

 gem install mygem

For uninstallation, use the following command,

 gem uninstall mygem

For listing installed gems, type the following,

 gem list

For listing available gem, write the following,

 gem list -r

In order to create RDoc documentation for all gems, type the following,

 gem rdoc -all

For adding a trusted certificate, type the following command,

 gem cert -a

If you want to download but you do not want to install the downloaded gem at that instant, for meeting that purpose type the following,

 gem fetch mygem

If you want to search the gems which are available for use, type the following command,

 gem search (STRING)  --remote

We have got a gem command which is available to provide help in building and maintaining ".gemspec" or ".gem" files. This process is known by the name of package building. If you want to build a .gem file from .gemspec file, use the following command on the gem terminal,

 gem build (gem_name).gemspec 





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.
Learn PCB Designing: PCB DESIGNING TUTORIAL




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.