Current section

54 Versions

Jump to

Compare versions

5 files changed
+16 additions
-6 deletions
  @@ -46,4 +46,4 @@
46 46 [{<<"app">>,<<"thoas">>},
47 47 {<<"optional">>,false},
48 48 {<<"requirement">>,<<"1.2.1">>}]}]}.
49 - {<<"version">>,<<"0.13.0">>}.
49 + {<<"version">>,<<"0.13.1">>}.
  @@ -1,6 +1,6 @@
1 1 {application,nova,
2 2 [{description,"Nova is a web application framework"},
3 - {vsn,"0.13.0"},
3 + {vsn,"0.13.1"},
4 4 {registered,[]},
5 5 {mod,{nova_app,[]}},
6 6 {included_applications,[]},
  @@ -52,6 +52,9 @@ run_plugins([{Callback, Options}|Tl], CallbackType, Req, Env) when is_function(C
52 52 {stop, Req0};
53 53 {stop, Reply, Req0, _State0} ->
54 54 Req1 = handle_reply(Reply, Req0),
55 + %% Since we are stopping we need to send the statuscode to the requester. This is a special case for stop.
56 + StatusCode = maps:get(resp_status_code, Req1, 200),
57 + cowboy_req:reply(StatusCode, Req1),
55 58 {stop, Req1}
56 59 end
57 60 catch
  @@ -72,7 +72,10 @@ start_link() ->
72 72 add_plugin({_Class, Module, _Opts}) ->
73 73 add_plugin(Module);
74 74 add_plugin(Module) when is_atom(Module) ->
75 - #{title := Title, version := Version} = Module:plugin_info(),
75 + #{title := Title, version := Version} = case Module:plugin_info() of
76 + {Title0, Version0, _, _, _} -> #{title => Title0, version => Version0};
77 + PluginInfo -> PluginInfo
78 + end,
76 79 add_plugin(Module, Title, Version);
77 80 add_plugin(Callback) when is_function(Callback) ->
78 81 Info = erlang:fun_info(Callback),
  @@ -71,10 +71,14 @@ init([]) ->
71 71 child(nova_plugin_manager, nova_plugin_manager),
72 72 child(nova_watcher, nova_watcher)
73 73 ],
74 +
75 + %% try to ensure callback module is loaded first
76 + ExportedFuns = SessionManager:module_info(exports),
77 +
74 78 Children =
75 - case erlang:function_exported(SessionManager, start_link, 0) of
76 - true -> [child(SessionManager, SessionManager) | Children0];
77 - false -> Children0
79 + case proplists:get_value(start_link, ExportedFuns) of
80 + 0 -> [child(SessionManager, SessionManager) | Children0];
81 + _ -> Children0
78 82 end,
79 83
80 84 setup_cowboy(Configuration),