Sha256: fe8b98bea1d68642c9a58d782cfb06ccf899688360508367b82d9f48572cb1f9

Contents?: true

Size: 911 Bytes

Versions: 12

Compression:

Stored size: 911 Bytes

Contents

-module(ernie_config).
-export([load/1]).

load(ConfigFile) ->
  {ok, Configs} = file:consult(ConfigFile),
  Configs2 = lists:map((fun load_single/1), Configs),
  {ok, Configs2}.

load_single(Config) ->
  case proplists:get_value(type, Config) of
    native ->
      verify(native, Config),
      CodePaths = proplists:get_value(codepaths, Config),
      lists:map((fun code:add_patha/1), CodePaths),
      Mod = proplists:get_value(module, Config),
      code:load_file(Mod),
      [{id, native} | Config];
    external ->
      verify(external, Config),
      Handler = proplists:get_value(command, Config),
      Number = proplists:get_value(count, Config),
      {ok, SupPid} = asset_pool_sup:start_link(Handler, Number),
      [{_Id, ChildPid, _Type, _Modules}] = supervisor:which_children(SupPid),
      [{id, ChildPid} | Config]
  end.

verify(native, _Config) ->
  ok;
verify(external, _Config) ->
  ok.

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
ernie-2.5.2 elib/ernie_config.erl
ernie-2.5.1 elib/ernie_config.erl
ernie-2.5.0 elib/ernie_config.erl
ernie-2.4.0 elib/ernie_config.erl
ernie-2.3.0 elib/ernie_config.erl
ernie-2.2.1 elib/ernie_config.erl
schleyfox-ernie-2.2.3 elib/ernie_config.erl
schleyfox-ernie-2.2.2 elib/ernie_config.erl
schleyfox-ernie-2.2.1 elib/ernie_config.erl
ernie-2.2.0 elib/ernie_config.erl
ernie-2.1.0 elib/ernie_config.erl
ernie-2.0.0 elib/ernie_config.erl