local utils_file = require('utils.file')
local utils = {}
function utils.route(route_file, ...)
local route_func = dofile(os.getenv('PROJECT_DIR') .. '/' .. route_file)
return route_func(...)
end
function utils.template(tmpl_file, ...)
local echoes_func = dofile(os.getenv('PROJECT_DIR') .. '/' .. tmpl_file)
print(echoes_func(...))
end
function utils.compare_file_content(file1, file2)
local fd1 = utils_file.open_s(file1, 'r')
if not fd1 then
print('Empty file', fd1)
return false
end
local fd2 = utils_file.open_s(file2, 'r')
if not fd2 then
print('Empty file', fd2)
fd1:close()
return false
end
local str1 = fd1:read('*a')
local str2 = fd2:read('*a')
fd1:close()
fd2:close()
return str1 == str2
end
return utils