Module: Passport::Installation::ClassMethods

Defined in:
lib/passport/core/installation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#installedObject

Returns the value of attribute installed.



8
9
10
# File 'lib/passport/core/installation.rb', line 8

def installed
  @installed
end

Instance Method Details

#installObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/passport/core/installation.rb', line 10

def install
  return if installed
  
  require "#{root}/lib/passport/support/#{adapter}"
  require "#{root}/lib/passport/oauth"
  
  if defined?(Rails)          
    custom_models = ["#{root}/lib/passport/support/#{adapter}"] + Dir["#{root}/lib/passport/oauth/tokens"]
    #custom_models +=  Dir["#{library}/openid/tokens"]
    
    # Rails 3/2 config
    load_path_method = ActiveSupport::Dependencies.respond_to?(:autoload_paths) ? :autoload_paths : :load_paths
    
    custom_models.each do |path|
      $LOAD_PATH << path
      ActiveSupport::Dependencies.send(load_path_method) << path
    end
  end
  
  if defined?(ActionController::Base)
    ActionController::Base.helper(Passport::Oauth::ViewHelper)
  end
  if defined?(ActionView::Helpers::FormBuilder)
    ActionView::Helpers::FormBuilder.send(:include, Passport::Oauth::ViewHelper)
  end
  
  installed = true
end