RubyGems
{{Short description|Package manager for Ruby}}
{{Primary sources|date=July 2021}}
{{redirect|Gem (software)|the 1980s desktop|GEM (desktop environment)}}
{{Infobox software
| name = RubyGems
| logo =
| screenshot =
| caption =
| author =
| developer =
| released =
| latest release version = {{wikidata|property|reference|P348}}
| latest release date = {{start date and age|{{wikidata|qualifier|P348|P577}}}}
| latest preview version =
| latest preview date =
| programming language = Ruby
| operating system = Cross-platform
| platform =
| language =
| genre = Package manager
| license = Ruby License
| website = {{URL|https://rubygems.org}}
}}
{{Infobox
| label2 = Total gems | data2 = [https://rubygems.org/stats 175,000+]
| label3 = Total downloads | data3 = [https://rubygems.org/stats 202+ billion]
}}
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. It was created by Chad Fowler, Jim Weirich, David Alan Black, Paul Brannan and Richard Kilmer in 2004.{{Cite web|url=https://devchat.tv/ruby-rogues/174-rubygems-with-eric-hodel|title=174 Rubygems with Eric Hodel|access-date=2018-05-09|archive-date=2021-07-31|archive-url=https://web.archive.org/web/20210731060214/https://devchat.tv/ruby-rogues/174-rubygems-with-eric-hodel/|url-status=dead}}
The interface for RubyGems is a command-line tool called gem which can install and manage libraries (the gems).{{Cite web|url=http://guides.rubygems.org/command-reference/|title=RubyGems Command Reference|last=|first=|date=|website=guides.rubygems.org|publisher=|access-date=2016-09-18}} RubyGems integrates with Ruby run-time loader to help find and load installed gems from standardized library folders. Though it is possible to use a private RubyGems repository, the public repository is most commonly used for gem management.
The public repository helps users find gems, resolve dependencies and install them. RubyGems is bundled with the standard Ruby package as of Ruby 1.9.{{Cite web|url=http://svn.ruby-lang.org/repos/ruby/tags/v1_9_1_0/NEWS|title=Ruby 1.9.1 changelog|last=|first=|date=|website=|publisher=|access-date=|archive-date=2022-01-17|archive-url=https://web.archive.org/web/20220117234323/https://svn.ruby-lang.org/repos/ruby/tags/v1_9_1_0/NEWS|url-status=dead}}
History
Development on RubyGems started in November 2003 and was released to the public on March 14, 2004, or Pi Day 2004.{{Cite web|url=https://github.com/rubygems/rubygems/blob/master/History.txt|title=Version history of RubyGems|last=|first=|date=|website=GitHub|publisher=|access-date=2016-09-18}}
It was created by Chad Fowler, Jim Weirich, David Alan Black, Paul Brannan and Richard Kilmer during RubyConf 2004.
In 2010, the default public repository for gems moved from gems.rubyforge.org to rubygems.org, which is still in use. Also, RubyGems development was moved to GitHub in 2010. Though RubyGems has existed since Ruby 1.8, it was not a part of the standard Ruby distribution until Ruby 1.9.{{cn|date=December 2024}}
There were 38 releases from 2004 to 2010.
Previously, compatibility with RubyGems and Ruby varied. Many versions of RubyGems are almost fully incompatible with many versions of Ruby and some versions had key features unusable. For example, Ruby 1.9 came with RubyGems 1.3.7 in its standard distribution, but RubyGems 1.4.x was not compatible with Ruby 1.9. This meant that updating RubyGems on Ruby 1.9 was not possible until RubyGems 1.5.0 was released in 2011, two years after the first stable release of Ruby 1.9.{{Cite web|url=https://www.ruby-lang.org/en/news/2009/01/30/ruby-1-9-1-released/|title=Ruby 1.9.1 released|website=www.ruby-lang.org|access-date=2016-09-18}} These compatibility issues led to a rapid development of RubyGems, switching to a 4–6 week release schedule, and more version releases.
There were 117 releases from 2011 to 2016. 45 versions were released in 2013, which is the highest number of releases in a year for RubyGems.
Structure of a gem
Every gem contains a name, version and platform. Gems work only on ruby designed for a particular platform based on CPU architecture and operating-system type and version.{{Cite web|url= http://guides.rubygems.org/what-is-a-gem/|title= What is a gem? - RubyGems.org|last= |first= |date= |website= guides.rubygems.org|publisher= |access-date= 2016-09-18}}
Each gem consists of:
- Code
- Documentation
- Gem specification (Gemspec)
The code organization follows the following structure for a gem called gem_name:
gem_name/
├── bin/
│ └── gem_name
├── lib/
│ └── gem_name.rb
├── test/
│ └── test_gem_name.rb
├── README
├── Rakefile
└── gem_name.gemspec
- The lib directory contains the code for the gem.
- The test (or spec) directory is used for testing.
- Rakefile is used by Rake to automate tests and to generate code.
- README includes the documentation, RDOC, for most gems.
- Gem specification (gemspec) contains information about the author of the gem, the time of creation and the purpose the gem serves.
Security concerns
Since gems run their own code in an application it may lead to various security issues due to installation of malicious gems. The creator of a malicious gem may be able to compromise the user's system or server.{{Cite web|url=https://guides.rubygems.org/security/|title=Security - RubyGems Guides|website=guides.rubygems.org|access-date=2016-09-23}}
A number of methods have been developed to counter the security threat:
- Cryptographic signing of gems since RubyGems version 0.8.11. The gem cert and gem install commands are used for this purpose.
- New signing models such as X509 and OpenPGP have been proposed and are actively being discussed among Ruby experts.
See also
{{Portal|Free and open-source software}}
References
{{Reflist}}
External links
- {{official|https://rubygems.org}}
- [https://www.linuxjournal.com/article/8967 Linux Journal article]
{{Ruby programming language}}
{{DEFAULTSORT:Rubygems}}