Make it possible to run rake gems:install for cas

The hard requires were causing rake to fail before it could even install
the rubycas-client gem. This kind of sucked.
This commit is contained in:
Eric Allen 2009-12-04 13:21:22 -05:00
parent aaf3965004
commit e17c1e1644
2 changed files with 15 additions and 10 deletions

View file

@ -33,11 +33,15 @@ class ApplicationController < ActionController::Base
# This will allow the user to view the index page without authentication # This will allow the user to view the index page without authentication
# but will process CAS authentication data if the user already # but will process CAS authentication data if the user already
# has an SSO session open. # has an SSO session open.
if (CASClient rescue nil)
# Only require sub-library if gem is installed and loaded
require 'casclient/frameworks/rails/filter'
before_filter CASClient::Frameworks::Rails::GatewayFilter, :only => :login before_filter CASClient::Frameworks::Rails::GatewayFilter, :only => :login
# This requires the user to be authenticated for viewing all other pages. # This requires the user to be authenticated for viewing all other pages.
before_filter CASClient::Frameworks::Rails::Filter, :except => [:login , :calendar] before_filter CASClient::Frameworks::Rails::Filter, :except => [:login , :calendar]
end end
end
before_filter :set_session_expiration before_filter :set_session_expiration
before_filter :set_time_zone before_filter :set_time_zone
before_filter :set_zindex_counter before_filter :set_zindex_counter

View file

@ -65,9 +65,7 @@ Rails::Initializer.run do |config|
# See Rails::Configuration for more options # See Rails::Configuration for more options
if ( SITE_CONFIG['authentication_schemes'].include? 'cas') if ( SITE_CONFIG['authentication_schemes'].include? 'cas')
#requires rubycas-client gem to be installed #requires rubycas-client gem to be installed
config.gem "rubycas-client" config.gem "rubycas-client", :lib => 'casclient'
require 'casclient'
require 'casclient/frameworks/rails/filter'
end end
end end
@ -106,10 +104,13 @@ end
if ( SITE_CONFIG['authentication_schemes'].include? 'cas') if ( SITE_CONFIG['authentication_schemes'].include? 'cas')
#requires rubycas-client gem to be installed #requires rubycas-client gem to be installed
if (CASClient rescue nil)
require 'casclient/frameworks/rails/filter'
CASClient::Frameworks::Rails::Filter.configure( CASClient::Frameworks::Rails::Filter.configure(
:cas_base_url => SITE_CONFIG['cas_server'] , :cas_base_url => SITE_CONFIG['cas_server'] ,
:cas_server_logout => SITE_CONFIG['cas_server_logout'] :cas_server_logout => SITE_CONFIG['cas_server_logout']
) )
end
end end
tracks_version='1.8devel' tracks_version='1.8devel'