English Portuguese (Brazil)
%post
# This adds the proper /etc/rc*.d links for the script
/sbin/chkconfig --add %{name}
%files
%{_initddir}/%{name}
%{_bindir}/deltacloudd
%dir %{app_root}/
%{app_root}/bin
#...
%files doc
%{_defaultdocdir}/%{name}
%{app_root}/tests
%{app_root}/%{name}.gemspec
%{app_root}/Rakefile
%changelog
#...
Note, that although the source is a RubyGem, we have to install the files manually under %\{_datadir}/%\{name}, %\{_bindir}, etc. to follow FHS and general packaging guidelines. If additional Fedora specific files (systemd `.service` files, configurations) are required, they SHOULD be
added via another `+%SOURCE+` tags
Source1: deltacloudd-fedora
placed into appropriate locations during `+%install+` stage
install -m 0755 %{SOURCE1} %{buildroot}%{_bindir}/deltacloudd
Running test suites
If there is test suite available for the package (even separately, for example not included in the gem but available in the upstream repository), it SHOULD be run in `+%check+`. The test suite is the only automated tool which can assure basic functionality of the package. Running it is especially helpful when mass rebuilds are required. You MAY skip test suite execution when not all build dependencies are met but this MUST be documented in the specfile. The missing build dependencies to enable the test suite SHOULD be packaged for Fedora as soon as possible and the test suite re-enabled.
The tests SHOULD NOT be run using Rake, as Rake almost always draws in some unnecessary dependencies like hoe or gemcutter. For similar reasons, a dependency on Bundler SHOULD be avoided. Also, code coverage frameworks such as SimpleCov and Coveralls SHOULD be avoided.
Testing With Different Ruby Implementations
To run tests with different Ruby implementation such as JRuby, add `BuildRequires: jruby`. Then use Rubypick's interpreter switching:
ruby _jruby_ -Ilib -e 'Dir.glob "./test/test_*.rb", &method(:require)'
If your package is running unittests for ruby-mri and it is intended to run under alternate interpreters then it needs to run the unittests under all alternate interpreters as well. This is the only method we have to check compatibility of the code under each interpreter. The same rules apply that you can omit this if libraries you need are unavailable for a specific alternate interpreter but you MUST have a comment to explain.
Testing frameworks usage
The Ruby community supports many testing frameworks. The following sections demonstrate how several to execute test suites using the more common of them.
MiniTest / Test::UNIT
MiniTest as well as Test::UNIT are shipped with Ruby. To use them, you need to use `BuildRequires: rubygem-minitest` or `BuildRequires: rubygem-testunit` respectively. To execute the test suite you can use something like: