What is a Ruby gem?

RubyGem

Ruby Problem Overview


I've searched on Google, and I just found the uses of gem. As in, gem install, etc.

Are gems collections of .rb scripts?

If I build a series of scripts, for example that wraps the functionality of Google translate, is the preferred way of distributing that for usage a gem?

If not, how would I distribute this code?

Ruby Solutions


Solution 1 - Ruby

According to [RubyGems Wiki - ][1]RubyGems is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries (in a self-contained format called a "gem"), a tool designed to easily manage the installation of gems, and a server for distributing them.

The gem command is used to build, upload, download, and install Gem packages. Gem Usage

RubyGems is very similar to apt-get, portage, and yum in functionality.

Installation:

gem install mygem

Uninstallation:

gem uninstall mygem

Listing installed gems:

gem list --local

Gem Package Building

The gem command may also be used to build and maintain .gemspec and .gem files.

Build .gem from a .gemspec file:

gem build mygem.gemspec

For more info, refer to [RubyGems Manuals][2].

[1]: https://en.wikipedia.org/wiki/RubyGems "RubyGems wiki" [2]: http://guides.rubygems.org/

Solution 2 - Ruby

Here are some nice tutorials :)

http://railscasts.com/episodes/135-making-a-gem
http://railscasts.com/episodes/245-new-gem-with-bundler

A gem is a module/Library that you can install and use in every project on your server. A plugin is a module/Library that you can use inside your project

Indeed, if you make some code what you like to share you can make a gem or plugin of it. You can publish it on for example github.com. You can check the source of the existing gems on github if you like to know how to make a gem as well.

Solution 3 - Ruby

Gem Package Building

Step : gem build your_gem_name.gemspec

simple steps follow click here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondeleteView Question on Stackoverflow
Solution 1 - RubyTCSGradView Answer on Stackoverflow
Solution 2 - RubyMichael KoperView Answer on Stackoverflow
Solution 3 - RubyAnjanView Answer on Stackoverflow