Skip to content

Instantly share code, notes, and snippets.

@pvalena
Created January 18, 2022 08:43
Show Gist options
  • Save pvalena/645979d2751a39d143d5d023fa730022 to your computer and use it in GitHub Desktop.
Save pvalena/645979d2751a39d143d5d023fa730022 to your computer and use it in GitHub Desktop.
--- rubygem-listen/.generated.spec 2022-01-18 09:26:45.635562035 +0100
+++ rubygem-listen/rubygem-listen.spec 2022-01-18 09:11:26.186537385 +0100
@@ -1,5 +1,4 @@
-Downloaded listen-3.7.1
-# Generated from listen-3.7.1.gem by gem2rpm -*- rpm-spec -*-
+# Generated from listen-0.4.7.gem by gem2rpm -*- rpm-spec -*-
%global gem_name listen
Name: rubygem-%{gem_name}
@@ -9,9 +8,15 @@
License: MIT
URL: https://github.com/guard/listen
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
+# git clone https://github.com/guard/listen.git --no-checkout
+# cd listen && git archive -v -o rubygem-listen-3.7.1-spec.txz v3.7.1 spec
+Source1: rubygem-listen-%{version}-spec.txz
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
-BuildRequires: ruby >= 2.4.0
+BuildRequires: ruby
+BuildRequires: rubygem(rb-inotify)
+BuildRequires: rubygem(thor)
+BuildRequires: rubygem(rspec)
BuildArch: noarch
%description
@@ -28,7 +33,16 @@
Documentation for %{name}.
%prep
-%setup -q -n %{gem_name}-%{version}
+%setup -q -n %{gem_name}-%{version} -b 1
+
+pushd %{_builddir}
+popd
+
+# Remove the hardcoded dependencies. We don't have them in Fedora
+# (except rb-inotify), they are platform specifis and not needed.
+# https://github.com/guard/listen/pull/54
+%gemspec_remove_dep -g rb-fsevent [">= 0.10.3", "~> 0.10"]
+sed -i '/def self.usable?$/a return false' lib/listen/adapter/darwin.rb
%build
# Create the gem as gem install only works on a gem file
@@ -52,7 +66,14 @@
%check
pushd .%{gem_instdir}
-# Run the test suite.
+# Move the tests into place
+ln -s %{_builddir}/spec spec
+
+# We removed dependencies from other platforms so let's remove
+# tests as well
+mv spec/lib/listen/adapter/darwin_spec.rb{,.disabled}
+
+rspec -rspec_helper spec
popd
%files
@@ -72,4 +93,103 @@
%changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment