diff --git a/.gitignore b/.gitignore index 44f6cc3..773b099 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ sinatra-1.0.gem /sinatra-1.4.3.gem /sinatra-1.4.5.gem /sinatra-1.4.6.gem +/sinatra-1.4.7.gem diff --git a/rubygem-sinatra-1.4.7-fix-for-rack-2.patch b/rubygem-sinatra-1.4.7-fix-for-rack-2.patch new file mode 100644 index 0000000..60239fb --- /dev/null +++ b/rubygem-sinatra-1.4.7-fix-for-rack-2.patch @@ -0,0 +1,78 @@ +diff --git lib/sinatra/base.rb lib/sinatra/base.rb +index 819dd37..d3ff4e5 100644 +--- lib/sinatra/base.rb ++++ lib/sinatra/base.rb +@@ -151,7 +151,7 @@ module Sinatra + if calculate_content_length? + # if some other code has already set Content-Length, don't muck with it + # currently, this would be the static file-handler +- headers["Content-Length"] = body.inject(0) { |l, p| l + Rack::Utils.bytesize(p) }.to_s ++ headers["Content-Length"] = body.inject(0) { |l, p| l + p.bytesize }.to_s + end + + [status.to_i, headers, result] +@@ -240,7 +240,11 @@ module Sinatra + def block.each; yield(call) end + response.body = block + elsif value +- headers.delete 'Content-Length' unless request.head? || value.is_a?(Rack::File) || value.is_a?(Stream) ++ # Rack 2.0 returns a Rack::File::Iterator here instead of ++ # Rack::File as it was in the previous API. ++ unless request.head? || value.is_a?(Rack::File::Iterator) || value.is_a?(Stream) ++ headers.delete 'Content-Length' ++ end + response.body = value + else + response.body +@@ -363,13 +367,13 @@ module Sinatra + + last_modified opts[:last_modified] if opts[:last_modified] + +- file = Rack::File.new nil +- file.path = path +- result = file.serving env ++ file = Rack::File.new(File.dirname(settings.app_file)) ++ result = file.serving(request, path) ++ + result[1].each { |k,v| headers[k] ||= v } + headers['Content-Length'] = result[1]['Content-Length'] + opts[:status] &&= Integer(opts[:status]) +- halt opts[:status] || result[0], result[2] ++ halt (opts[:status] || result[0]), result[2] + rescue Errno::ENOENT + not_found + end +@@ -1065,6 +1069,7 @@ module Sinatra + # Run the block with 'throw :halt' support and apply result to the response. + def invoke + res = catch(:halt) { yield } ++ + res = [res] if Fixnum === res or String === res + if Array === res and Fixnum === res.first + res = res.dup +diff --git lib/sinatra/show_exceptions.rb lib/sinatra/show_exceptions.rb +index 2e3069f..2988cc4 100644 +--- lib/sinatra/show_exceptions.rb ++++ lib/sinatra/show_exceptions.rb +@@ -44,7 +44,7 @@ module Sinatra + 500, + { + "Content-Type" => content_type, +- "Content-Length" => Rack::Utils.bytesize(body.join).to_s ++ "Content-Length" => body.join.bytesize.to_s + }, + body + ] +diff --git test/settings_test.rb test/settings_test.rb +index 7ec03c6..1b135f5 100644 +--- test/settings_test.rb ++++ test/settings_test.rb +@@ -244,7 +244,7 @@ class SettingsTest < Minitest::Test + get '/' + assert_equal 500, status + assert body.include?("StandardError") +- assert body.include?("show_exceptions setting") ++ assert body.include?("Rack::ShowExceptions") + end + + it 'does not override app-specified error handling when set to :after_handler' do diff --git a/rubygem-sinatra.spec b/rubygem-sinatra.spec index cb204a6..060d945 100644 --- a/rubygem-sinatra.spec +++ b/rubygem-sinatra.spec @@ -4,12 +4,18 @@ Summary: Ruby-based web application framework Name: rubygem-%{gem_name} -Version: 1.4.6 -Release: 3%{?dist} +Version: 1.4.7 +Release: 1%{?dist} Group: Development/Languages License: MIT URL: http://www.sinatrarb.com/ Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem +# Patch for Rack 2.x. +# https://github.com/sinatra/sinatra/commit/6aea9f8 +# https://github.com/sinatra/sinatra/commit/fad3619 +# https://github.com/sinatra/sinatra/commit/1a9642b +# https://github.com/sinatra/sinatra/commit/1dfae3d +Patch0: rubygem-sinatra-1.4.7-fix-for-rack-2.patch BuildRequires: rubygems-devel %if 0%{bootstrap} < 1 BuildRequires: rubygem(rack) >= 1.4.0 @@ -36,10 +42,20 @@ Requires: %{name} = %{epoch}:%{version}-%{release} This package contains documentation for %{name}. %prep -%setup -q -c -T -%gem_install -n %{SOURCE0} +gem unpack %{SOURCE0} + +%setup -q -D -T -n %{gem_name}-%{version} + +gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec + +# Support rack 2.x +# https://github.com/sinatra/sinatra/commit/e7ef8e2 +sed -i '// s/"~> 1.5"/">= 1.5", "< 3"/' %{gem_name}.gemspec +%patch0 -p0 %build +gem build %{gem_name}.gemspec +%gem_install %check %if 0%{bootstrap} < 1 @@ -55,7 +71,7 @@ cp -rv .%{gem_dir}/* %{buildroot}%{gem_dir} rm %{buildroot}/%gem_instdir/.yardopts # Remove YARD configuration %files -%doc %{gem_instdir}/LICENSE +%license %{gem_instdir}/LICENSE %dir %{gem_instdir} %{gem_libdir} %{gem_instdir}/sinatra.gemspec @@ -69,11 +85,16 @@ rm %{buildroot}/%gem_instdir/.yardopts # Remove YARD configuration %doc %{gem_instdir}/README.md %doc %{gem_instdir}/README.*.md %doc %{gem_instdir}/AUTHORS.md -%doc %{gem_instdir}/CHANGES +%doc %{gem_instdir}/CHANGELOG.md +%doc %{gem_instdir}/CONTRIBUTING.md %{gem_instdir}/examples %{gem_instdir}/Gemfile %changelog +* Mon Aug 01 2016 Jun Aruga - 1:1.4.7-1 +- Update to 1.4.7 +- Fix broken dependency for rack 2.x. + * Thu Feb 04 2016 Fedora Release Engineering - 1:1.4.6-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild diff --git a/sources b/sources index 9126962..0bf001f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -81cd2f7ac83db17a858c109ed054b82d sinatra-1.4.6.gem +757adc7bc6bf427c0948e683ce07b441 sinatra-1.4.7.gem