Skip to content

Instantly share code, notes, and snippets.

@pvalena
Created September 6, 2021 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pvalena/253ba2dbf157f835c6ce8bb0af74b4d7 to your computer and use it in GitHub Desktop.
Save pvalena/253ba2dbf157f835c6ce8bb0af74b4d7 to your computer and use it in GitHub Desktop.
--- rubygem-sd_notify/.generated.spec 2021-09-06 17:53:17.276869885 +0200
+++ rubygem-sd_notify/rubygem-sd_notify.spec 2021-09-06 17:52:08.463086172 +0200
@@ -8,12 +8,16 @@
License: MIT
URL: https://github.com/agis/ruby-sdnotify
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
+# At the time of the packaging there were tests only in master branch.
+# The test suite is not shiped with the gem, you may check it out like so
+# git clone --no-checkout https://github.com/agis/ruby-sdnotify
+# cd ruby-sdnotify && git archive -v -o ruby-sdnotify-0.1.1-tests.txz a7d52eef8dc3e026309c41c2421649863e0cabba test/
+Source1: ruby-sdnotify-%{version}-tests.txz
+
BuildRequires: ruby(release)
+BuildRequires: rubygem(minitest)
BuildRequires: rubygems-devel
BuildRequires: ruby
-# BuildRequires: rubygem(minitest)
-# BuildRequires: rubygem(rubocop)
-# BuildRequires: rubygem(rubocop-performance)
BuildArch: noarch
%description
@@ -30,14 +33,10 @@
Documentation for %{name}.
%prep
-%setup -q -n %{gem_name}-%{version}
+%setup -q -n %{gem_name}-%{version} -b1
%build
-# Create the gem as gem install only works on a gem file
gem build ../%{gem_name}-%{version}.gemspec
-
-# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
-# by default, so that we can move it into the buildroot in %%install
%gem_install
%install
@@ -45,11 +44,12 @@
cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
-
-
%check
pushd .%{gem_instdir}
-# ruby -e 'Dir.glob "./test/**/*_test.rb", &method(:require)'
+# Symlink the test suite into plaec
+ln -s %{_builddir}/test .
+
+ruby -Ilib -e 'Dir.glob("./test/**/*_test.rb").sort.each{ |f| require f }'
popd
%files
@@ -65,5 +65,5 @@
%doc %{gem_instdir}/README.md
%changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment