Module: Initializer

Defined in:
lib/initializer.rb

Class Method Summary collapse

Class Method Details

.add_load_paths!(paths) ⇒ Object


39
40
41
42
43
44
# File 'lib/initializer.rb', line 39

def self.add_load_paths!(paths)
  paths = Array(paths)
  paths.each do |path|
    $LOAD_PATH << File.expand_path(path, Config.root)
  end
end

.add_pathsObject


14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/initializer.rb', line 14

def self.add_paths
  add_load_paths! Config.root
  add_load_paths! %w(
    lib
    app
    app/api
    app/models
    app/interactors
    app/helpers
    app/representers
    app/roles
  )
end

.require!(globs) ⇒ Object


32
33
34
35
36
37
# File 'lib/initializer.rb', line 32

def self.require!(globs)
  globs = [globs] unless globs.is_a?(Array)
  globs.each do |f|
    Pliny::Utils.require_glob("#{Config.root}/#{f}.rb")
  end
end

.require_configObject


10
11
12
# File 'lib/initializer.rb', line 10

def self.require_config
  require_relative "../config/config"
end

.require_initializersObject


28
29
30
# File 'lib/initializer.rb', line 28

def self.require_initializers
  Pliny::Utils.require_glob("#{Config.root}/config/initializers/*.rb")
end

.runObject


4
5
6
7
8
# File 'lib/initializer.rb', line 4

def self.run
  require_config
  add_paths
  require_initializers
end