Skip to content

Commit

Permalink
cleaned names and finished theme processsing mode
Browse files Browse the repository at this point in the history
aleksanderwlodarczyk committed Feb 1, 2019
1 parent fe4e86f commit 1d4a04c
Showing 19 changed files with 10 additions and 4 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 10 additions & 4 deletions file_patcher/load_and_patch.lua → preprocessors/patch.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
function file_patcher.load_and_patch(name, mode, pre_content_write, post_content_write)
function file_patcher.patch(name, mode, pre_content_write, post_content_write)

if mode == "theme" or mode == "themes" then
-- load_themes function here

for _, fn in ipairs(file_patcher.preprocessors.themes) do
fn(name)
end

return
end

package.preload[name] = function(modulename)
@@ -19,17 +24,18 @@ function file_patcher.load_and_patch(name, mode, pre_content_write, post_content

elseif mode == "action" mode == "actions" then
local header = file_patcher.extract_header(modulepath)
for _, fn in ipairs(file_patcher.preprocessors[mode]) do
for _, fn in ipairs(file_patcher.preprocessors.actions) do
fn(created_file, header, modulepath)
end

elseif mode == "rule" or mode == "rules" then
local header = file_patcher.extract_header(modulepath)
local priority = header.priority or 1

for _, fn in ipairs(file_patcher.preprocessors[mode]) do
for _, fn in ipairs(file_patcher.preprocessors.rules) do
fn(created_file, header, modulename, priority, modulepath)
end

end

created_file:close()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 1d4a04c

Please sign in to comment.