From 50ec4f429531079b02626dbfe022c302be5af8e8 Mon Sep 17 00:00:00 2001 From: Water-Melon Date: Wed, 15 Nov 2023 09:29:09 +0800 Subject: [PATCH] chore(*): organize directory structure --- index.m => controllers/index.m | 4 ++-- proc.m => controllers/proc.m | 6 +++--- bootstrap.m => coroutines/bootstrap.m | 2 +- http.m => coroutines/http.m | 4 ++-- task.m => coroutines/task.m | 2 +- meproc.m | 8 ++++---- log.m => utils/log.m | 2 +- validator.m => utils/validator.m | 0 index.html => web/index.html | 0 9 files changed, 14 insertions(+), 14 deletions(-) rename index.m => controllers/index.m (88%) rename proc.m => controllers/proc.m (98%) rename bootstrap.m => coroutines/bootstrap.m (88%) rename http.m => coroutines/http.m (96%) rename task.m => coroutines/task.m (95%) rename log.m => utils/log.m (98%) rename validator.m => utils/validator.m (100%) rename index.html => web/index.html (100%) diff --git a/index.m b/controllers/index.m similarity index 88% rename from index.m rename to controllers/index.m index 21472ea..d82d6a2 100644 --- a/index.m +++ b/controllers/index.m @@ -1,4 +1,4 @@ -#include "@/conf/conf.m" +#include "@/../conf/conf.m" F = Import('file'); S = Import('sys'); @@ -12,7 +12,7 @@ } @index() { - path = S.path('@/index.html'); + path = S.path('@/../web/index.html'); f = $F; if (!f.open(path, 'r')) { R['code'] = 404; diff --git a/proc.m b/controllers/proc.m similarity index 98% rename from proc.m rename to controllers/proc.m index 09e4821..84e3721 100644 --- a/proc.m +++ b/controllers/proc.m @@ -1,5 +1,5 @@ -#include "@/log.m" -#include "@/validator.m" +#include "@/../utils/log.m" +#include "@/../utils/validator.m" J = Import('json'); S = Import('sys'); @@ -211,7 +211,7 @@ for (i = 0; i < n; ++i) { alias = name + ':' + i; - Eval('@/task.m', J.encode([ + Eval('@/../coroutines/task.m', J.encode([ 'conf': prog, 'alias': alias, ]), false, alias); diff --git a/bootstrap.m b/coroutines/bootstrap.m similarity index 88% rename from bootstrap.m rename to coroutines/bootstrap.m index 5a65ef1..4aa42aa 100644 --- a/bootstrap.m +++ b/coroutines/bootstrap.m @@ -1,4 +1,4 @@ -#include "@/log.m" +#include "@/../utils/log.m" sys = Import('sys'); diff --git a/http.m b/coroutines/http.m similarity index 96% rename from http.m rename to coroutines/http.m index 69e0af2..c2fced0 100644 --- a/http.m +++ b/coroutines/http.m @@ -1,5 +1,5 @@ -#include "@/proc.m" -#include "@/index.m" +#include "@/../controllers/proc.m" +#include "@/../controllers/index.m" sys = Import('sys'); net = Import('net'); diff --git a/task.m b/coroutines/task.m similarity index 95% rename from task.m rename to coroutines/task.m index 0af17f9..9c124ee 100644 --- a/task.m +++ b/coroutines/task.m @@ -1,4 +1,4 @@ -#include "@/log.m" +#include "@/../utils/log.m" j = Import('json'); s = Import('sys'); diff --git a/meproc.m b/meproc.m index 53c1813..5e64a33 100644 --- a/meproc.m +++ b/meproc.m @@ -1,4 +1,4 @@ -#include "@/log.m" +#include "@/utils/log.m" net = Import('net'); mq = Import('mq'); @@ -10,10 +10,10 @@ return; } fi -Log('info', "Meproc v1.0.2. Listen on: " + Conf['ip'] + ':' + Conf['port']); +Log('info', "Meproc v1.0.3. Listen on: " + Conf['ip'] + ':' + Conf['port']); -Eval('@/http.m'); -Eval('@/bootstrap.m', nil, false, 'bootstrap'); +Eval('@/coroutines/http.m'); +Eval('@/coroutines/bootstrap.m', nil, false, 'bootstrap'); while (1) { fd = net.tcp_accept(listenfd); diff --git a/log.m b/utils/log.m similarity index 98% rename from log.m rename to utils/log.m index 457657b..083d523 100644 --- a/log.m +++ b/utils/log.m @@ -1,6 +1,6 @@ #if !M_LOG #define M_LOG -#include "@/conf/conf.m" +#include "@/../conf/conf.m" Sys = Import('sys'); F = Import('file'); diff --git a/validator.m b/utils/validator.m similarity index 100% rename from validator.m rename to utils/validator.m diff --git a/index.html b/web/index.html similarity index 100% rename from index.html rename to web/index.html