sinatra 0.9.0.2 → 0.9.0.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sinatra might be problematic. Click here for more details.

data/CHANGES CHANGED
@@ -1,3 +1,17 @@
1
+ = 0.9.0.3 / 2009-01-21
2
+
3
+ * Fall back on mongrel then webrick when thin not found. [#75]
4
+ * Use :environment instead of :env in test helpers to
5
+ fix deprecation warnings coming from framework.
6
+ * Make sinatra/test/rspec work again [#113]
7
+ * Fix app_file detection on windows [#118]
8
+ * Fix static files with Rack::Lint in pipeline [#121]
9
+
10
+ = 0.9.0.2 / 2009-01-18
11
+
12
+ * Halting a before block should stop processing of routes [#85]
13
+ * Fix redirect/halt in before filters [#85]
14
+
1
15
  = 0.9.0 / 2009-01-18
2
16
 
3
17
  * Works with and requires Rack >= 0.9.1
@@ -4,7 +4,7 @@ require 'rack'
4
4
  require 'rack/builder'
5
5
 
6
6
  module Sinatra
7
- VERSION = '0.9.0.2'
7
+ VERSION = '0.9.0.3'
8
8
 
9
9
  class Request < Rack::Request
10
10
  def user_agent
@@ -142,6 +142,7 @@ module Sinatra
142
142
  class StaticFile < ::File #:nodoc:
143
143
  alias_method :to_path, :path
144
144
  def each
145
+ rewind
145
146
  while buf = read(8192)
146
147
  yield buf
147
148
  end
@@ -630,8 +631,8 @@ module Sinatra
630
631
  end
631
632
 
632
633
  def run!(options={})
633
- set(options)
634
- handler = Rack::Handler.get(server)
634
+ set options
635
+ handler = detect_rack_handler
635
636
  handler_name = handler.name.gsub(/.*::/, '')
636
637
  puts "== Sinatra/#{Sinatra::VERSION} has taken the stage " +
637
638
  "on #{port} for #{environment} with backup from #{handler_name}"
@@ -652,6 +653,17 @@ module Sinatra
652
653
  end
653
654
 
654
655
  private
656
+ def detect_rack_handler
657
+ servers = Array(self.server)
658
+ servers.each do |server_name|
659
+ begin
660
+ return Rack::Handler.get(server_name)
661
+ rescue LoadError
662
+ end
663
+ end
664
+ fail "Server handler (#{servers.join(',')}) not found."
665
+ end
666
+
655
667
  def construct_middleware(builder=Rack::Builder.new)
656
668
  builder.use Rack::Session::Cookie if sessions?
657
669
  builder.use Rack::CommonLogger if logging?
@@ -698,7 +710,7 @@ module Sinatra
698
710
  set :environment, (ENV['RACK_ENV'] || :development).to_sym
699
711
 
700
712
  set :run, false
701
- set :server, (defined?(Rack::Handler::Thin) ? "thin" : "mongrel")
713
+ set :server, %w[thin mongrel webrick]
702
714
  set :host, '0.0.0.0'
703
715
  set :port, 4567
704
716
 
@@ -9,7 +9,7 @@ module Sinatra
9
9
  /custom_require\.rb$/ # rubygems require hacks
10
10
  ]
11
11
  path =
12
- caller.map{ |line| line.split(':', 2).first }.find do |file|
12
+ caller.map{ |line| line.split(/:\d/, 2).first }.find do |file|
13
13
  next if ignore.any? { |pattern| file =~ pattern }
14
14
  file
15
15
  end
@@ -2,7 +2,7 @@ require 'bacon'
2
2
  require 'sinatra/test'
3
3
 
4
4
  Sinatra::Default.set(
5
- :env => :test,
5
+ :environment => :test,
6
6
  :run => false,
7
7
  :raise_errors => true,
8
8
  :logging => false
@@ -1,8 +1,10 @@
1
1
  require 'sinatra/test'
2
+ require 'sinatra/test/unit'
3
+ require 'spec'
2
4
  require 'spec/interop/test'
3
5
 
4
6
  Sinatra::Default.set(
5
- :env => :test,
7
+ :environment => :test,
6
8
  :run => false,
7
9
  :raise_errors => true,
8
10
  :logging => false
@@ -4,7 +4,7 @@ require 'test/unit'
4
4
  Test::Unit::TestCase.send :include, Sinatra::Test
5
5
 
6
6
  Sinatra::Default.set(
7
- :env => :test,
7
+ :environment => :test,
8
8
  :run => false,
9
9
  :raise_errors => true,
10
10
  :logging => false
@@ -3,8 +3,8 @@ Gem::Specification.new do |s|
3
3
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
4
4
 
5
5
  s.name = 'sinatra'
6
- s.version = '0.9.0.2'
7
- s.date = '2009-01-18'
6
+ s.version = '0.9.0.3'
7
+ s.date = '2009-01-21'
8
8
 
9
9
  s.description = "Classy web-development dressed in a DSL"
10
10
  s.summary = "Classy web-development dressed in a DSL"
@@ -18,6 +18,16 @@ describe 'Static' do
18
18
  assert response.headers.include?('Last-Modified')
19
19
  end
20
20
 
21
+ it 'produces a body that can be iterated over multiple times' do
22
+ env = Rack::MockRequest.env_for("/#{F.basename(__FILE__)}")
23
+ status, headers, body = @app.call(env)
24
+ buf1, buf2 = [], []
25
+ body.each { |part| buf1 << part }
26
+ body.each { |part| buf2 << part }
27
+ assert_equal buf1.join, buf2.join
28
+ assert_equal File.read(__FILE__), buf1.join
29
+ end
30
+
21
31
  it 'serves HEAD requests for files in the public directory' do
22
32
  head "/#{F.basename(__FILE__)}"
23
33
  assert ok?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0.2
4
+ version: 0.9.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Mizerany
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-18 00:00:00 -08:00
12
+ date: 2009-01-21 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency