2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

Fixed all broken specs

Moved middleware config into authenticators
This commit is contained in:
Sam 2013-08-26 11:04:16 +10:00
parent 912d4b853b
commit 213ce33af2
20 changed files with 137 additions and 328 deletions

View file

@ -5,7 +5,8 @@ require_dependency 'plugin/auth_provider'
class Plugin::Instance
attr_reader :auth_providers, :assets, :path
attr_reader :auth_providers, :assets
attr_accessor :path, :metadata
def self.find_all(parent_path)
[].tap { |plugins|
@ -17,12 +18,16 @@ class Plugin::Instance
}
end
def initialize(metadata, path)
def initialize(metadata=nil, path=nil)
@metadata = metadata
@path = path
@assets = []
end
def name
metadata.name
end
# will make sure all the assets this plugin needs are registered
def generate_automatic_assets!
paths = []
@ -152,13 +157,10 @@ class Plugin::Instance
@auth_providers ||= []
provider = Plugin::AuthProvider.new
provider.type = type
[:name, :glyph, :background_color, :title, :message, :frame_width, :frame_height, :callback].each do |sym|
[:name, :glyph, :background_color, :title, :message, :frame_width, :frame_height, :authenticator].each do |sym|
provider.send "#{sym}=", opts.delete(sym)
end
provider.name ||= type.to_s
provider.options = opts[:middleware_options] || opts
# prepare for splatting
provider.options = [provider.options] if provider.options.is_a? Hash
@auth_providers << provider
end