Class: Spree::Auth::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/spree/auth/engine.rb

Class Method Summary collapse

Class Method Details

.activateObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/spree/auth/engine.rb', line 27

def self.activate
  Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
    Rails.configuration.cache_classes ? require(c) : load(c)
  end
  if Spree::Auth::Engine.backend_available?
    Dir.glob(File.join(File.dirname(__FILE__), "../../controllers/backend/*/*/*_decorator*.rb")) do |c|
      Rails.configuration.cache_classes ? require(c) : load(c)
    end
  end
  if Spree::Auth::Engine.frontend_available?
    Dir.glob(File.join(File.dirname(__FILE__), "../../controllers/frontend/**/*_decorator*.rb")) do |c|
      Rails.configuration.cache_classes ? require(c) : load(c)
    end
  end
  if Spree::Auth::Engine.api_available?
    Dir.glob(File.join(File.dirname(__FILE__), "../../controllers/api/**/*_decorator*.rb")) do |c|
      Rails.configuration.cache_classes ? require(c) : load(c)
    end
  end
  ApplicationController.send :include, Spree::AuthenticationHelpers
end

.api_available?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/spree/auth/engine.rb', line 49

def self.api_available?
  @@api_available ||= ::Rails::Engine.subclasses.map(&:instance).map{ |e| e.class.to_s }.include?('Spree::Api::Engine')
end

.backend_available?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/spree/auth/engine.rb', line 53

def self.backend_available?
  @@backend_available ||= ::Rails::Engine.subclasses.map(&:instance).map{ |e| e.class.to_s }.include?('Spree::Backend::Engine')
end

.frontend_available?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/spree/auth/engine.rb', line 57

def self.frontend_available?
  @@frontend_available ||= ::Rails::Engine.subclasses.map(&:instance).map{ |e| e.class.to_s }.include?('Spree::Frontend::Engine')
end