This spec is an attempt to keep Ruby updated to the latest stable version available and to be used on Amazon Linux AMI.
It specifies a new set of Ruby RPMs using a suffix, like ruby25-2.5.9-1.0.1.amzn1.x86_64.rpm (and executables ruby2.5). It allows to install a new ruby version keeping old versions running at the same time.
Ruby 2.5.9
Move the repository contents for an directory like that:
/home/ec2-user/packaging/ruby-rpm-spec
And run rpmbuild to build Ruby:
cd /home/ec2-user/packaging/ruby-rpm-spec && rm -rf BUILDROOT/* BUILD/* RPMS/x86_64/* RPMS/noarch/* && cd SPECS/ && rpmbuild -ba --buildroot=/home/ec2-user/packaging/ruby-rpm-spec/BUILDROOT --define='_topdir /home/ec2-user/packaging/ruby-rpm-spec' --sign ruby25.spec
Or Bundler:
cd /home/ec2-user/packaging/ruby-rpm-spec && rm -rf BUILDROOT/* BUILD/* RPMS/x86_64/* RPMS/noarch/* && cd SPECS/ && rpmbuild -ba --buildroot=/home/ec2-user/packaging/ruby-rpm-spec/BUILDROOT --define='_topdir /home/ec2-user/packaging/ruby-rpm-spec' --sign rubygem-bundler.spec
Important: if you try to rebuild the spec with the generated ruby and rubygems RPMs already installed on the system, you'll get and error regarding the gems directory. In this case, you need first to remove the RPMs and then build and install the new ones. There is some compatibility issue building this spec with the packages already installed. If you know why please tell me :)
sudo rpm -ivh noarch/rubygem25-rdoc-6.0.1.1-1.0.1.amzn1.noarch.rpm x86_64/* noarch/rubygems25-2.7.6.3-1.0.1.amzn1.noarch.rpm noarch/ruby25-irb-2.5.9-1.0.1.amzn1.noarch.rpm
This spec is based on Fedora's spec available on https://src.fedoraproject.org/rpms/ruby.
Also, it has been used the spec of the latest ruby rpm available on Amazon's repositories.