From 41b25648ac61e20718354bc32c1531b10524cc71 Mon Sep 17 00:00:00 2001 From: lxsang Date: Thu, 25 Jun 2020 21:55:55 +0200 Subject: [PATCH] add ci control --- Makefile | 2 +- ci/Makefile | 5 +++++ ci/router.lua | 46 ++++++++++++++++++++++++++++++++++++++++++++++ get/router.lua | 2 +- 4 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 ci/Makefile create mode 100644 ci/router.lua diff --git a/Makefile b/Makefile index 45c8ce0..5cb607f 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ BUILDDIR?=./build -PROJS?=grs info blog apps os doc +PROJS?=grs info blog apps os doc ci copyfiles = index.ls mimes.json main: copy for f in $(PROJS); do BUILDDIR=$(BUILDDIR)/"$${f}" make -C "$${f}" ; done diff --git a/ci/Makefile b/ci/Makefile new file mode 100644 index 0000000..51c8686 --- /dev/null +++ b/ci/Makefile @@ -0,0 +1,5 @@ +copyfiles = router.lua + +main: + - mkdir $(BUILDDIR) + cp -rvf $(copyfiles) $(BUILDDIR) \ No newline at end of file diff --git a/ci/router.lua b/ci/router.lua new file mode 100644 index 0000000..8b1ab6c --- /dev/null +++ b/ci/router.lua @@ -0,0 +1,46 @@ + +-- the rewrite rule for the framework +-- should be something like this +-- ^\/apps\/+(.*)$ = /apps/router.lua?r=<1>& +-- some global variables +DIR_SEP = "/" +WWW_ROOT = __ROOT__.."/ci" +if HEADER.Host then + HTTP_ROOT= "https://"..HEADER.Host +else + HTTP_ROOT = "https://ci.iohub.dev" +end +-- class path: path.to.class +BASE_FRW = "" +-- class path: path.to.class +CONTROLLER_ROOT = BASE_FRW.."apps.controllers" +MODEL_ROOT = BASE_FRW.."apps.models" +-- file path: path/to/file +VIEW_ROOT = WWW_ROOT..DIR_SEP.."views" +LOG_ROOT = WWW_ROOT..DIR_SEP.."logs" + +-- require needed library +require(BASE_FRW.."silk.api") + +function NotfoundController:index(...) + local args = {...} + return false +end + + +-- registry object store global variables +local REGISTRY = {} +-- set logging level +REGISTRY.logger = Logger:new{ levels = {INFO = false, ERROR = false, DEBUG = false}} + +REGISTRY.layout = 'default' +REGISTRY.fileaccess = false + +local router = Router:new{registry = REGISTRY} +REGISTRY.router = router +router:setPath(CONTROLLER_ROOT) +--router:route('edit', 'post/edit', "ALL" ) + +router:route('default', default_routes_dependencies ) +router:delegate() + diff --git a/get/router.lua b/get/router.lua index b55d93d..0feba75 100644 --- a/get/router.lua +++ b/get/router.lua @@ -8,7 +8,7 @@ WWW_ROOT = __ROOT__.."/get" if HEADER.Host then HTTP_ROOT= "https://"..HEADER.Host else - HTTP_ROOT = "https://get.makeand.run" + HTTP_ROOT = "https://get.iohub.dev" end -- class path: path.to.class BASE_FRW = ""