Fixed autoload issues.

This commit is contained in:
Martin Edenhofer 2012-11-18 12:04:03 +01:00
parent 7a91637de4
commit 998a7f55d4
7 changed files with 50 additions and 94 deletions

View file

@ -16,7 +16,7 @@ module Zammad
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
config.autoload_paths += Dir["#{config.root}/lib/**/"]
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
@ -25,12 +25,13 @@ module Zammad
# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
config.active_record.observers =
:history_observer,
'ticket::_observer::_first_response',
'ticket::_observer::_last_contact',
'ticket::_observer::_close_time',
'ticket::_observer::_user_ticket_counter',
'ticket::_observer::_notification'
'observer::_history',
'observer::_ticket::_first_response',
'observer::_ticket::_last_contact',
'observer::_ticket::_close_time',
'observer::_ticket::_user_ticket_counter',
'observer::_ticket::_notification',
'observer::_tag::_ticket_history'
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.

View file

@ -1,27 +1,5 @@
# Load the rails application
require File.expand_path('../application', __FILE__)
# load session helper
require 'session_helper'
# load module used to get current user for active recorde observer
require 'user_info'
# load omniauth strategies with database lookups api keys at runtime
require 'twitter_database'
require 'facebook_database'
require 'linked_in_database'
require 'google_oauth2_database'
# load notification factory (replace all tags)
require 'notification_factory'
# load lib
require 'gmaps'
require 'rss'
require 'cache'
require 'web_socket'
# Initialize the rails application
Zammad::Application.initialize!

View file

@ -1,20 +1,14 @@
module OmniAuth
module Strategies
class FacebookDatabase < OmniAuth::Strategies::Facebook
option :name, 'facebook'
class FacebookDatabase < OmniAuth::Strategies::Facebook
option :name, 'facebook'
def initialize(app, *args, &block)
def initialize(app, *args, &block)
# database lookup
# database lookup
# puts 'FacebookDatabase -> initialize'
config = Setting.get('auth_facebook_credentials') || {}
args[0] = config['app_id']
args[1] = config['app_secret']
super
end
end
config = Setting.get('auth_facebook_credentials') || {}
args[0] = config['app_id']
args[1] = config['app_secret']
super
end
end

View file

@ -1,20 +1,14 @@
module OmniAuth
module Strategies
class GoogleOauth2Database < OmniAuth::Strategies::GoogleOauth2
option :name, 'google_oauth2'
class GoogleOauth2Database < OmniAuth::Strategies::GoogleOauth2
option :name, 'google_oauth2'
def initialize(app, *args, &block)
def initialize(app, *args, &block)
# database lookup
# database lookup
# puts 'GoogleOauth2Database -> initialize'
config = Setting.get('auth_google_oauth2_credentials') || {}
args[0] = config['client_id']
args[1] = config['client_secret']
super
end
end
config = Setting.get('auth_google_oauth2_credentials') || {}
args[0] = config['client_id']
args[1] = config['client_secret']
super
end
end

View file

@ -1,20 +1,14 @@
module OmniAuth
module Strategies
class LinkedInDatabase < OmniAuth::Strategies::LinkedIn
option :name, 'linkedin'
class LinkedInDatabase < OmniAuth::Strategies::LinkedIn
option :name, 'linkedin'
def initialize(app, *args, &block)
def initialize(app, *args, &block)
# database lookup
# database lookup
# puts 'LinkedInDatabase -> initialize'
config = Setting.get('auth_linkedin_credentials') || {}
args[0] = config['app_id']
args[1] = config['app_secret']
super
end
end
config = Setting.get('auth_linkedin_credentials') || {}
args[0] = config['app_id']
args[1] = config['app_secret']
super
end
end

View file

@ -1,20 +0,0 @@
module OmniAuth
module Strategies
class TwitterDatabase < OmniAuth::Strategies::Twitter
option :name, 'twitter'
def initialize(app, *args, &block)
# database lookup
# puts 'TwitterDatabase -> initialize'
config = Setting.get('auth_twitter_credentials') || {}
args[0] = config['key']
args[1] = config['secret']
super
end
end
end
end

15
lib/twitter_database.rb Normal file
View file

@ -0,0 +1,15 @@
class TwitterDatabase < OmniAuth::Strategies::Twitter
option :name, 'twitter'
def initialize(app, *args, &block)
require 'Setting'
# database lookup
# puts 'TwitterDatabase -> initialize'
config = Setting.get('auth_twitter_credentials') || {}
args[0] = config['key']
args[1] = config['secret']
super
end
end