Class: Munge::Load

Inherits:
Object
  • Object
show all
Defined in:
lib/munge/load.rb

Instance Method Summary collapse

Constructor Details

#initialize(root_path) ⇒ Load

Returns a new instance of Load.



3
4
5
6
7
8
9
# File 'lib/munge/load.rb', line 3

def initialize(root_path)
  boot_config_path = File.join(root_path, "boot.yml")

  @root_path = Pathname.new(root_path)
  @boot_config = YAML.load(File.read(boot_config_path))
  @config = Munge::Config.new
end

Instance Method Details

#appObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/munge/load.rb', line 11

def app
  Dir.chdir(@root_path) do
    config_load

    conglomerate = Munge::Conglomerate.new(@root_path.to_s, @config)
    application = Munge::Application.new(conglomerate)

    thread_variable_set_helper(@boot_config["conglomerate_key"], conglomerate) do
      thread_variable_set_helper(@boot_config["application_key"], application) do
        thread_variable_set_helper(@boot_config["config_key"], @config) do
          thread_variable_set_helper(@boot_config["root_path_key"], @root_path) do
            load_from_boot_config_key("boot_path")
            load_from_boot_config_key("rules_path")

            yield application, conglomerate
          end
        end
      end
    end
  end
end