Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add compatibility with Rack version ~>1.0 #80

Merged
merged 1 commit into from

2 participants

Chad Woolley Rajan Agaskar
Chad Woolley

This adds backward compatibility with Rack versions < 1.1. Still lots of people on Rails < 2.3.6, this enables them to use Jasmine gem.

Rajan Agaskar
Owner

Chad, thanks for this. I'll have to update the test matrix on travis so we're explicitly checking compatibility with Rack 1.0 before I merge this to HEAD (since there's otherwise no tests here), but no, I don't see any reason not to add this.

Rajan Agaskar ragaskar merged commit 8ed674f into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 18, 2012
  1. Chad Woolley
This page is out of date. Refresh to see the latest.
2  jasmine.gemspec
View
@@ -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 lib/jasmine/config.rb
View
@@ -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
4 lib/jasmine/server.rb
View
@@ -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
Something went wrong with that request. Please try again.