2010-10-14 14:04:02 -04:00
begin
require " omniauth/core "
rescue LoadError = > e
warn " Could not load 'omniauth/core'. Please ensure you have the oa-core gem installed and listed in your Gemfile. "
raise
end
2011-02-24 14:50:22 -05:00
unless OmniAuth . config . respond_to? :test_mode
warn " Devise's OmniAuth testing support is deprecated. You should use Omniauth's own support, please ensure you have 0.2.0.beta version or later installed. "
2010-10-14 14:04:02 -04:00
end
2010-10-14 15:16:20 -04:00
# Clean up the default path_prefix. It will be automatically set by Devise.
OmniAuth . config . path_prefix = nil
2011-02-24 14:50:22 -05:00
OmniAuth . config . on_failure = Proc . new do | env |
2010-10-29 16:43:13 -04:00
env [ 'devise.mapping' ] = Devise :: Mapping . find_by_path! ( env [ 'PATH_INFO' ] , :path )
2010-10-14 19:15:17 -04:00
controller_klass = " #{ env [ 'devise.mapping' ] . controllers [ :omniauth_callbacks ] . camelize } Controller "
controller_klass . constantize . action ( :failure ) . call ( env )
end
2010-10-14 14:04:02 -04:00
module Devise
module OmniAuth
autoload :Config , " devise/omniauth/config "
autoload :UrlHelpers , " devise/omniauth/url_helpers "
autoload :TestHelpers , " devise/omniauth/test_helpers "
class << self
2010-10-14 17:46:10 -04:00
delegate :short_circuit_authorizers! , :unshort_circuit_authorizers! ,
:test_mode! , :stub! , :reset_stubs! , :to = > " Devise::OmniAuth::TestHelpers "
2010-10-14 14:04:02 -04:00
end
end
2010-11-03 19:16:55 -04:00
end