Skip to content

Commit

Permalink
Compatibility with Rack version ~>1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
thewoolleyman committed Mar 18, 2012
1 parent 34c1529 commit 8ed674f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion jasmine.gemspec
Expand Up @@ -59,7 +59,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'json_pure'

s.add_dependency 'jasmine-core', ">= 1.2.0.rc1"
s.add_dependency 'rack', '>= 1.1'
s.add_dependency 'rack', '~> 1.0'
s.add_dependency 'rspec', '>= 1.3.1'
s.add_dependency 'selenium-webdriver', '>= 0.1.3'
end
11 changes: 8 additions & 3 deletions lib/jasmine/config.rb
Expand Up @@ -16,9 +16,14 @@ def jasmine_port
end

def start_server(port = 8888)
server = Rack::Server.new(:Port => port, :AccessLog => [])
server.instance_variable_set(:@app, Jasmine.app(self)) # workaround for Rack bug, when Rack > 1.2.1 is released Rack::Server.start(:app => Jasmine.app(self)) will work
server.start
if defined? Rack::Server # Rack ~>1.0 compatibility
server = Rack::Server.new(:Port => port, :AccessLog => [])
server.instance_variable_set(:@app, Jasmine.app(self)) # workaround for Rack bug, when Rack > 1.2.1 is released Rack::Server.start(:app => Jasmine.app(self)) will work
server.start
else
handler = Rack::Handler.get('mongrel')
handler.run(Jasmine.app(self), :Port => port, :AccessLog => [])
end
end

def start
Expand Down
4 changes: 3 additions & 1 deletion lib/jasmine/server.rb
Expand Up @@ -74,7 +74,9 @@ def call(env)
def self.app(config)
Rack::Builder.app do
use Rack::Head
use Rack::ETag, "max-age=0, private, must-revalidate"
if defined? Rack::ETag # Rack ~>1.0 compatibility
use Rack::ETag, "max-age=0, private, must-revalidate"
end
if Jasmine::Dependencies.rails_3_asset_pipeline?
map('/assets') do
run Rails.application.assets
Expand Down

0 comments on commit 8ed674f

Please sign in to comment.