From 92b0802327b892c85e0f524784b4a90db1c6e5cd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Sun, 6 Oct 2013 13:48:15 +0300 Subject: [PATCH] new, version 1.5.0 based on fedora rubygem-thin package 97bf81fa560fe1eb0ca9e05c94ef55261d5312eb --- fix-install-spec.patch | 13 +++++ remove-rspec1-require.patch | 10 ++++ rspec2-null-object.patch | 31 +++++++++++ ruby-thin.spec | 107 ++++++++++++++++++++++++++++++++++++ 4 files changed, 161 insertions(+) create mode 100644 fix-install-spec.patch create mode 100644 remove-rspec1-require.patch create mode 100644 rspec2-null-object.patch create mode 100644 ruby-thin.spec diff --git a/fix-install-spec.patch b/fix-install-spec.patch new file mode 100644 index 0000000..d6e6f52 --- /dev/null +++ b/fix-install-spec.patch @@ -0,0 +1,13 @@ +diff --git a/spec/controllers/service_spec.rb b/spec/controllers/service_spec.rb +index 10abdaf..3cff608 100644 +--- a/spec/controllers/service_spec.rb ++++ b/spec/controllers/service_spec.rb +@@ -28,7 +28,7 @@ describe Service do + + File.exist?(Service::INITD_PATH).should be_true + File.read(Service::INITD_PATH).should include('CONFIG_PATH=tmp/sandbox/etc/thin', +- 'SCRIPT_NAME=tmp/sandbox/etc/init.d/thin', ++ 'SCRIPT_NAME=tmp/sandbox' + (File.directory?('/etc/rc.d') ? '/etc/rc.d/thin' : '/etc/init.d/thin'), + 'DAEMON=' + Command.script) + end + diff --git a/remove-rspec1-require.patch b/remove-rspec1-require.patch new file mode 100644 index 0000000..7447a8a --- /dev/null +++ b/remove-rspec1-require.patch @@ -0,0 +1,10 @@ +--- a/spec/spec_helper.rb ++++ b/spec/spec_helper.rb +@@ -1,7 +1,5 @@ + require 'rubygems' + require 'thin' +-gem "rspec", "~> 1.2.9" +-require 'spec' + require 'benchmark' + require 'timeout' + require 'fileutils' diff --git a/rspec2-null-object.patch b/rspec2-null-object.patch new file mode 100644 index 0000000..23f8201 --- /dev/null +++ b/rspec2-null-object.patch @@ -0,0 +1,31 @@ +--- a/spec/backends/swiftiply_client_spec.rb ++++ b/spec/backends/swiftiply_client_spec.rb +@@ -3,7 +3,7 @@ + describe Backends::SwiftiplyClient do + before do + @backend = Backends::SwiftiplyClient.new('0.0.0.0', 3333) +- @backend.server = mock('server', :null_object => true) ++ @backend.server = mock('server').as_null_object + end + + it "should connect" do +@@ -26,7 +26,7 @@ + before do + @connection = SwiftiplyConnection.new(nil) + @connection.backend = Backends::SwiftiplyClient.new('0.0.0.0', 3333) +- @connection.backend.server = mock('server', :null_object => true) ++ @connection.backend.server = mock('server').as_null_object + end + + it do +--- a/spec/connection_spec.rb ++++ b/spec/connection_spec.rb +@@ -3,7 +3,7 @@ + describe Connection do + before do + EventMachine.stub(:send_data) +- @connection = Connection.new(mock('EM', :null_object => true)) ++ @connection = Connection.new(mock('EM').as_null_object) + @connection.post_init + @connection.backend = mock("backend", :ssl? => false) + @connection.app = proc do |env| diff --git a/ruby-thin.spec b/ruby-thin.spec new file mode 100644 index 0000000..65ddbd0 --- /dev/null +++ b/ruby-thin.spec @@ -0,0 +1,107 @@ +# +# Conditional build: +%bcond_with tests # build without tests + +%define pkgname thin +Summary: A thin and fast web server +Name: ruby-%{pkgname} +Version: 1.5.0 +Release: 1 +License: (GPL v2 or Ruby) and MIT +Group: Development/Languages +Source0: http://rubygems.org/gems/%{pkgname}-%{version}.gem +# Source0-md5: 2f011aba841da210e49d09b85130dfc0 +# git clone https://github.com/macournoyer/thin.git && cd thin && git checkout v1.5.0 +# tar czvf thin-1.5.0-tests.tgz spec/ +Source1: http://pkgs.fedoraproject.org/repo/pkgs/rubygem-thin/thin-%{version}-tests.tgz/d7ee25c7f947151b93501668c53e2d34/thin-%{version}-tests.tgz +# Source1-md5: d7ee25c7f947151b93501668c53e2d34 +# https://github.com/macournoyer/thin/issues/77 +Patch1: remove-rspec1-require.patch +Patch2: rspec2-null-object.patch +# https://github.com/macournoyer/thin/issues/76 +Patch3: fix-install-spec.patch +URL: http://code.macournoyer.com/thin/ +BuildRequires: rpm-rubyprov +BuildRequires: rpmbuild(macros) >= 1.656 +BuildRequires: ruby-devel +BuildRequires: sed >= 4.0 +%if %{with tests} +BuildRequires: ruby-daemons >= 1.0.9 +BuildRequires: ruby-eventmachine >= 0.12.6 +BuildRequires: ruby-rack >= 1.0.0 +BuildRequires: ruby-rspec +%endif +Requires: curl +Requires: ruby-daemons >= 1.0.9 +Requires: ruby-eventmachine >= 0.12.6 +Requires: ruby-rack >= 1.0.0 +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) + +%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} +Group: Documentation +Requires: %{name} = %{version}-%{release} + +%description doc +Documentation for %{name}. + +%prep +%setup -q -n %{pkgname}-%{version} -a1 +%{__sed} -i -e '1 s,#!.*ruby,#!%{__ruby},' bin/* +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 + +%build +cd ext/thin_parser +%{__ruby} extconf.rb +%{__make} \ + CC="%{__cc}" \ + LDFLAGS="%{rpmldflags}" \ + CFLAGS="%{rpmcflags} -fPIC" + +%if %{with tests} +# Depends on rubygem-benchmark_unit, not available in Fedora yet. +rm -rf spec/perf +# Test fails. +# https://github.com/macournoyer/thin/issues/40 +rm -f spec/server/pipelining_spec.rb +# The 'should force kill process in pid file' spec is not compatible with RSpec2. +# https://github.com/rspec/rspec-core/issues/520 +# http://rubyforge.org/tracker/?func=detail&aid=29450&group_id=524&atid=2086 +ruby -ne "print unless (99..117).include? $." spec/daemonizing_spec.rb > spec/daemonizing_spec.rb + +rspec spec +%endif + +%install +rm -rf $RPM_BUILD_ROOT +install -d $RPM_BUILD_ROOT{%{ruby_vendorlibdir},%{_bindir}} +cp -a lib/* $RPM_BUILD_ROOT%{ruby_vendorlibdir} +cp -a bin/* $RPM_BUILD_ROOT%{_bindir} + +# install ext +install -d $RPM_BUILD_ROOT%{ruby_vendorarchdir} +install -p ext/thin_parser/thin_parser.so $RPM_BUILD_ROOT%{ruby_vendorarchdir} + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(644,root,root,755) +%doc README.md +%attr(755,root,root) %{_bindir}/thin +%{ruby_vendorlibdir}/thin +%{ruby_vendorlibdir}/thin.rb +%attr(755,root,root) %{ruby_vendorarchdir}/thin_parser.so + +# rack adapter +%{ruby_vendorlibdir}/rack/adapter/loader.rb +%{ruby_vendorlibdir}/rack/adapter/rails.rb -- 2.44.0