Description of problem:
gem2rpm is used to generate RPM spec files from gem files (tar balls from rubygems.org) to enable building ruby gems into RPM files.
The problem is that the default spec distributed with gem2rpm, which is what the gem2rpm command uses by default is incompatible with the rubygems setup epel uses:
1. It generates RPM files named ruby-gems-<gem-name> instead of rubygem-<gem-name>
2. It requires a ruby gems package names ruby-gems instead of rubygems
3. It requires a source file named ruby-gems-<gem-name>.spec.in that is nowhere to be found.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Download a gem file from rubygems.org to ~/rpmbuild/SOURCES
2. Run gem2rpm on it and save the output as a spec file to ~/rpmbuild/SPECS
3. Try to build the spec file using rpmbuild -ba
The build fails due to missing build requirement of ruby-gems even though rubygems is installed. If this is fixed manually then several other errors crop by.
The gem should be converted to RPM without errors.
The best approach to fix this is probably to create a new spec template for EPEL, possibly based on the Fedora template.
I found that the fedora template works mostly fine to build gems, so I just copied it to epel.spec.erb and added this to distro.rb:
(this also works for CentOS 6 as that also has a /etc/redhat-release file)
As you already found, the "default.spec.erb" template is used if the distribution is not recognized, which is the case of EPEL. However, you can always use the "--template TEMPLATE" to specify your very own template without need of patching gem2rpm.
I would like to accept the change you have proposed, but I am bit reluctant, because I am not using EPEL personally and this template would need some maintainer. Would you volunteer for maintaining the EPEL template?
Other solution is to use the "fedora.spec.erb" template also for EPEL, i.e. to change  into form:
Thanks for the reply.
Initially I used the fedora template, but found that it is also missing some things (such as requiring gcc when building GEMs with native extensions).
I'm willing to maintain an EPEL specific template, or if its possible to fix the Fedora template to work for EPEL that would also work nicely - though I'm not using Fedora with GEMs, so I have no way to test how suggested changes affect Fedora.
May be the best would be if you can send a pull request on github with your proposed changes? Or show me the template you used for EPEL ...
Please open PR on GitHub if you are still interested. I'm closing this issue. Thank you.