webmcp
annotate framework/env/execute/_initializers.lua @ 242:f66037207da8
Skip application based initializers in interactive mode
author | jbe |
---|---|
date | Sun Mar 01 16:23:39 2015 +0100 (2015-03-01) |
parents | 6ac7133bb58e |
children | 2ddbb44680f7 |
rev | line source |
---|---|
jbe@214 | 1 function execute._initializers(initializer_path_element) |
jbe@214 | 2 local yieldvalue = {} |
jbe@214 | 3 local coro = coroutine.wrap(function() |
jbe@214 | 4 execute.multi_wrapped( |
jbe@214 | 5 execute._create_sorted_execution_list( |
jbe@214 | 6 function(add_by_path) |
jbe@214 | 7 add_by_path(initializer_path_element) |
jbe@242 | 8 if WEBMCP_APP_NAME then -- allow for interactive mode |
jbe@242 | 9 add_by_path(WEBMCP_APP_NAME, initializer_path_element) |
jbe@242 | 10 end |
jbe@214 | 11 end, |
jbe@214 | 12 function(full_path, relative_path) |
jbe@214 | 13 execute.file_path{ file_path = full_path } |
jbe@214 | 14 end |
jbe@214 | 15 ), |
jbe@214 | 16 function() |
jbe@214 | 17 coroutine.yield(yieldvalue) |
jbe@214 | 18 end |
jbe@214 | 19 ) |
jbe@214 | 20 return yieldvalue |
jbe@214 | 21 end) |
jbe@214 | 22 local function cont() |
jbe@214 | 23 assert(coro() == yieldvalue, "Unexpected yield") |
jbe@214 | 24 end |
jbe@214 | 25 cont() |
jbe@214 | 26 execute._finalizers[#execute._finalizers+1] = cont |
jbe@214 | 27 end |