Skip to content
This repository

Add compatibility with Rack version ~>1.0 #80

Merged
merged 1 commit into from about 2 years ago

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
Collaborator

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 April 03, 2012
Rajan Agaskar ragaskar closed this April 03, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Mar 17, 2012
Chad Woolley Compatibility with Rack version ~>1.0 8ed674f
This page is out of date. Refresh to see the latest.
2  jasmine.gemspec
@@ -59,7 +59,7 @@ Gem::Specification.new do |s|
59 59
   s.add_development_dependency 'json_pure'
60 60
 
61 61
   s.add_dependency 'jasmine-core', ">= 1.2.0.rc1"
62  
-  s.add_dependency 'rack', '>= 1.1'
  62
+  s.add_dependency 'rack', '~> 1.0'
63 63
   s.add_dependency 'rspec', '>= 1.3.1'
64 64
   s.add_dependency 'selenium-webdriver', '>= 0.1.3'
65 65
 end
11  lib/jasmine/config.rb
@@ -16,9 +16,14 @@ def jasmine_port
16 16
     end
17 17
 
18 18
     def start_server(port = 8888)
19  
-      server = Rack::Server.new(:Port => port, :AccessLog => [])
20  
-      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
21  
-      server.start
  19
+      if defined? Rack::Server # Rack ~>1.0 compatibility
  20
+        server = Rack::Server.new(:Port => port, :AccessLog => [])
  21
+        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
  22
+        server.start
  23
+      else
  24
+        handler = Rack::Handler.get('mongrel')
  25
+        handler.run(Jasmine.app(self), :Port => port, :AccessLog => [])
  26
+      end
22 27
     end
23 28
 
24 29
     def start
4  lib/jasmine/server.rb
@@ -74,7 +74,9 @@ def call(env)
74 74
   def self.app(config)
75 75
     Rack::Builder.app do
76 76
       use Rack::Head
77  
-      use Rack::ETag, "max-age=0, private, must-revalidate"
  77
+      if defined? Rack::ETag # Rack ~>1.0 compatibility
  78
+        use Rack::ETag, "max-age=0, private, must-revalidate"
  79
+      end
78 80
       if Jasmine::Dependencies.rails_3_asset_pipeline?
79 81
         map('/assets') do
80 82
           run Rails.application.assets
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.