package init

This commit is contained in:
tushenmei 2020-08-28 15:35:32 +08:00
parent fe2b31587a
commit 339e1cce53
6 changed files with 139 additions and 0 deletions

View File

@ -0,0 +1,35 @@
From fd9aad1ccc736d0ceaa36dfe1732390427354788 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Mon, 8 Jan 2018 13:23:43 +0100
Subject: [PATCH] Mock Kernel.warn in Ruby 2.5 compatible way.
Ruby changed the way Kernel#warn reports the error [1], but mocking the
method on the class, which is calling it, should be universal [2].
[1] https://bugs.ruby-lang.org/issues/12944
[2] https://www.reddit.com/r/ruby/comments/2nki9q/rspec_how_do_you_mock_or_stub_kernel_methods_like/
---
spec/runner_spec.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/spec/runner_spec.rb b/spec/runner_spec.rb
index 825783d..cee6b91 100644
--- a/spec/runner_spec.rb
+++ b/spec/runner_spec.rb
@@ -65,10 +65,10 @@ describe Runner do
end
it "should warn when require a rack config file" do
- STDERR.stub!(:write)
- STDERR.should_receive(:write).with(/WARNING:/)
-
runner = Runner.new(%w(start -r config.ru))
+
+ runner.should_receive(:warn).with(/WARNING:/)
+
runner.run! rescue nil
runner.options[:rackup].should == 'config.ru'
--
2.15.1

86
rubygem-thin.spec Normal file
View File

@ -0,0 +1,86 @@
%global gem_name thin
Name: rubygem-%{gem_name}
Version: 1.7.2
Release: 1
Summary: A thin and fast web server
License: (GPLv2+ or Ruby) and BSD and MIT
URL: https://rubygems.org/gems/%{gem_name}/versions/%{version}
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
Source1: https://github.com/macournoyer/thin/archive/v%{version}.tar.gz
# Fix the test suite error due to way Ruby 2.5 reports warnings.
# https://github.com/macournoyer/thin/pull/346
Patch0: rubygem-thin-1.7.2-Mock-Kernel.warn-in-Ruby-2.5-compatible-way.patch
BuildRequires: ruby(release) rubygems-devel ruby-devel gcc rubygem(rspec2)
BuildRequires: rubygem(eventmachine) >= 1.0.4 rubygem(daemons) >= 1.0.9 rubygem(rack) >= 1.0.0
%description
Thin is a Ruby web server that glues together three of the best Ruby
libraries in web history.
The Mongrel parser, the root of Mongrel speed and security,
Event Machine, a network I/O library with extremely high scalability and
Rack, a minimal interface between webservers and Ruby frameworks.
%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description doc
Documentation for %{name}.
%prep
%setup -q -c -T
%gem_install -n %{SOURCE0}
%build
%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
mkdir -p %{buildroot}%{gem_extdir_mri}
cp -a .%{gem_extdir_mri}/{gem.build_complete,*.so} %{buildroot}%{gem_extdir_mri}/
rm -rf %{buildroot}%{gem_instdir}/ext/
mkdir -p %{buildroot}%{_bindir}
cp -a .%{_bindir}/* \
%{buildroot}%{_bindir}/
find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x
pushd %{buildroot}/%{gem_instdir}/example
chmod 755 async_chat.ru
chmod 755 async_tailer.ru
popd
%check
pushd .%{gem_instdir}
tar xzvf %{SOURCE1}
cp -r thin-%{version}/spec spec
cat %{PATCH0} | patch -p1
find spec/perf -name "*_spec.rb" -exec \
sed -i '/be_faster_then/ i \ pending' {} \;
sed -i -r "/'should (force )?kill process in pid file'/a \ pending" \
spec/daemonizing_spec.rb
sed -i '/^ def server_should_start_in_less_then/,/^ end/ s/(10)/(20)/' \
spec/daemonizing_spec.rb
sed -i '/"tracing routines (with NO custom logger)"/a \ before { pending }' \
spec/logging_spec.rb
rspec2 -I$(dirs +1)%{gem_extdir_mri} spec
popd
%files
%dir %{gem_instdir}
%{_bindir}/thin
%{gem_extdir_mri}
%{gem_instdir}/bin
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}
%files doc
%doc %{gem_docdir}
%{gem_instdir}/example/
%doc %{gem_instdir}/CHANGELOG
%doc %{gem_instdir}/README.md
%{gem_instdir}/Rakefile
%changelog
* Sat Aug 22 2020 tuShenmei <tushenmei@huawei.com> - 1.7.2-1
- package init

4
rubygem-thin.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: NA
src_repo: NA
tag_prefix: "thin-"
separator: "."

14
temp.patch Normal file
View File

@ -0,0 +1,14 @@
--- rubygem-thin1.spec 2020-08-18 16:00:38.520006155 +0800
+++ rubygem-thin.spec 2020-08-18 10:52:29.976017810 +0800
@@ -4,9 +4,9 @@
Release: 1
Summary: A thin and fast web server
License: (GPLv2+ or Ruby) and BSD and MIT
-URL: http://code.macournoyer.com/thin/
+URL: https://rubygems.org/gems/thin/versions/1.7.2
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
-Source1: %{gem_name}-%{version}-tests.tgz
+#Source1: %%{gem_name}-%%{version}-tests.tgz
Patch0: rubygem-thin-1.7.2-Mock-Kernel.warn-in-Ruby-2.5-compatible-way.patch
BuildRequires: ruby(release) rubygems-devel ruby-devel gcc rubygem(rspec2)
BuildRequires: rubygem(eventmachine) >= 1.0.4 rubygem(daemons) >= 1.0.9 rubygem(rack) >= 1.0.0

BIN
thin-1.7.2.gem Normal file

Binary file not shown.

BIN
v1.7.2.tar.gz Normal file

Binary file not shown.