English Portuguese (Brazil)
The name of a ruby extension/library package MUST start with the interpreter it is built for (ruby, jruby, etc.) and then the `UPSTREAM` name. For example: `ruby-UPSTREAM`. If the upstream name `UPSTREAM` contains `ruby`, that SHOULD be dropped from the name. For example, the SQLite database driver for ruby is called `sqlite3-ruby`. The corresponding Fedora package SHOULD be called `ruby-sqlite3`, and not `ruby-sqlite3-ruby`.
Application packages that mainly provide user-level tools that happen to be written in Ruby MUST follow the general xref:Naming.adoc[Naming Guidelines] instead.
Macros
Non-gem ruby packages and ruby gem packages install to certain standard locations. The `ruby-devel` and `rubygems-devel` packages contain macros useful for the respective package types. Alternate ruby interpreters will have equivalent locations (to be added to this table later).
|Macro
|Expanded path
|Usage

3+|*From ruby-devel; intended for non-gem packages.*

|`+%{ruby_vendorarchdir}+`
|`+/usr/lib{64}/ruby/vendor_ruby+`
|Place for architecture specific (e.g. *.so) files.

|`+%{ruby_vendorlibdir}+`
|`+/usr/share/ruby/vendor_ruby+`
|Place for architecture independent (e.g. *.rb) files.

|`+%{ruby_sitearchdir}+`
|`+/usr/local/lib{64}/ruby/site_ruby+`
|Place for local architecture specific (e.g. *.so) files.

|`+%{ruby_sitelibdir}+`
|`+/usr/local/share/ruby/site_ruby+`
|Place for local architecture independent (e.g. *.rb) files.

3+|*From rubygems-devel; intended for gem packages.*

|`+%{gem_dir}+`
|`+/usr/share/gems+`
|Top directory for the Gem structure.

|`+%{gem_instdir}+`
|`+%{gem_dir}/gems/%{gem_name}-%{version}+`
|Directory with the actual content of the Gem.

|`+%{gem_libdir}+`
|`+%{gem_instdir}/lib+`
|The `lib` folder of the Gem.

|`+%{gem_cache}+`
|`+%{gem_dir}/cache/%{gem_name}-%{version}.gem+`
|The cached Gem.

|`+%{gem_spec}+`
|`+%{gem_dir}/specifications/%{gem_name}-%{version}.gemspec+`
|The Gem specification file.

|`+%{gem_docdir}+`
|`+%{gem_dir}/doc/%{gem_name}-%{version}+`
|The rdoc documentation of the Gem.

|`+%{gem_extdir_mri}+`
|`+%{_libdir}/gems/ruby/%{gem_name}-%{version}+`
|The directory for MRI Ruby Gem extensions.

Interpreter independence and directory macros
You might have noticed that the table above has different directories for non-gem libraries on different ruby interpreters but only a single set of directories for rubygem libraries. This is because code written for one ruby interpreter will often run on all ruby interpreters that Fedora ships (ruby, jruby, etc.). However, some code uses methods that are not available on all interpreters (see <<Different Interpreters Compatibility>>). Rubygems have a facility to ship different versions of the code in the same gem so that the gem can run on all versions of the interpreter, so we only need to have one common directory for rubygems that all the interpreters can use.
The standard ruby `+%{vendorlib}+` directories lack this facility. For this reason, non-gem libraries need to be placed in per-interpreter directories and MUST have a separate subpackage (or package depending on upstream) for each interpreter that they support.
Libraries
These guidelines only apply to Ruby packages whose main purpose is providing a Ruby library; packages that mainly provide user-level tools that happen to be written in Ruby MUST follow the <<Applications,Ruby applications Guidelines>> instead.
RubyGems
https://rubygems.org/[RubyGems] are Ruby's own packaging format. Gems contain a lot of the same metadata that RPM's need, making fairly smooth interoperation between RPM and Gems possible. This guideline ensures that Gems are packaged as RPMs in a way that such RPMs fit cleanly with the rest of the distribution and makes it possible for the end user to satisfy dependencies of a Gem by installing the appropriate RPM-packaged Gem.
Both RPM's and Gems use similar terminology; there are specfiles, package names, dependencies, etc. for both. To keep confusion to a minimum, terms relating to Gem concepts will be explicitly referred to with the word "Gem" prefixed, e.g., "Gem specification" (.gemspec). An unqualified "package" in the following always means an RPM.
Spec files MUST contain a definition of `+%{gem_name}+` which is the name from the Gem's specification.
The `Source` of the package MUST be the full URL to the released Gem archive; the version of the package MUST be the Gem's version.
The package MUST have `BuildRequires: rubygems-devel` to pull in the macros needed to build.
There SHOULD NOT be any rubygem `Requires` nor `Provides` listed, since those are autogenerated.
There SHOULD NOT be `Requires: ruby(release)`, unless you want to explicitly specify Ruby version compatibility. The automatically generated dependency on RubyGems (`Requires: ruby(rubygems)`) is enough.
Filtering Requires and Provides
Runtime requires and provides are automatically generated by RPM's dependency generator. However, it can sometimes throw in additional dependencies contrary to reality. To fix this, the dependency generator needs to be overridden so that the additional dependencies can be filtered out. See xref:AutoProvidesAndRequiresFiltering.adoc[AutoProvidesAndRequiresFiltering] for details.