Permalink
Browse files

OmniAuth is now compatible with 1.3 and 1.4 Rack. Closes #562

  • Loading branch information...
1 parent 966a465 commit 21739ee956852f3be46ab5628a1fa7616d8dab39 Michael Bleigh committed Jan 17, 2012
Showing with 24 additions and 2 deletions.
  1. +3 −0 .travis.yml
  2. +1 −0 Gemfile
  3. +4 −0 Gemfile.rack-1.3.x
  4. +14 −0 lib/omniauth/builder.rb
  5. +2 −2 omniauth.gemspec
View
@@ -5,3 +5,6 @@ rvm:
- jruby
- rbx
- ree
+gemfiles:
+ - Gemfile
+ - Gemfile.rack-1.3.x
View
@@ -1,3 +1,4 @@
source 'https://rubygems.org'
+gem 'rack', '~> 1.4'
gemspec
View
@@ -0,0 +1,4 @@
+source 'https://rubygems.org'
+
+gem 'rack', '~> 1.3.0'
+gemspec
View
@@ -2,6 +2,19 @@
module OmniAuth
class Builder < ::Rack::Builder
+ def initialize(app, &block)
+ if rack14?
+ super
+ else
+ @app = app
+ super(&block)
+ end
+ end
+
+ def rack14?
+ Rack.release.split('.')[1].to_i >= 4
+ end
+
def on_failure(&block)
OmniAuth.config.on_failure = block
end
@@ -25,6 +38,7 @@ def provider(klass, *args, &block)
end
def call(env)
+ @ins << @app unless rack14? || @ins.include?(@app)
to_app.call(env)
end
end
View
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
gem.authors = ['Michael Bleigh', 'Erik Michaels-Ober']
gem.email = ['michael@intridea.com', 'sferik@gmail.com']
- gem.add_runtime_dependency 'rack', '~> 1.4'
+ gem.add_runtime_dependency 'rack'
gem.add_runtime_dependency 'hashie', '~> 1.2'
gem.add_development_dependency 'growl'
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'rake'
gem.add_development_dependency 'rb-fsevent'
gem.add_development_dependency 'rdiscount'
- gem.add_development_dependency 'rspec'
+ gem.add_development_dependency 'rspec', '~> 2.8'
gem.add_development_dependency 'yard'
gem.version = OmniAuth::VERSION

4 comments on commit 21739ee

Contributor

nicolasblanco replied Jan 18, 2012

Hi Michael!

Great but unfortunately Rack devs have forgotten to update the Rack.release and updated it 2 days after the latest release 1.4.0 :
rack/rack@e20baec

Contributor

nicolasblanco replied Jan 20, 2012

Please vote for my Rack issue here :
rack/rack#322

Please DO NOT come and +1 rack tickets. The more you assholes fill my inbox, the less time I will spend working on rack.

The fact that you think I need a bunch of anonymous people to come and spam on a ticket in order to persuade me something is important implies that I'm some kind of asshole who doesn't care about your use cases. I'm a better person than that, so give me a fucking break.

Contributor

nicolasblanco replied Jan 22, 2012

@raggi : bad day ? Take a 🍺 and relax ❤️

Please sign in to comment.