From 704aa3f7df21235152b529c54f004a193f56018a Mon Sep 17 00:00:00 2001 From: XeroOl Date: Sun, 9 Jun 2024 16:17:15 -0500 Subject: [PATCH] clean up tools to make things more clear --- Makefile | 44 +++++++++++---------- tools/{vendor.fnl => get-deps.fnl} | 4 +- tools/{gen-docs.fnl => get-docs.fnl} | 5 ++- tools/{gen-docs => get-docs}/lua-manual.fnl | 0 tools/{gen-docs => get-docs}/tic80.fnl | 0 tools/unvendor.fnl | 7 ---- tools/util/sh.fnl | 2 +- 7 files changed, 30 insertions(+), 32 deletions(-) rename tools/{vendor.fnl => get-deps.fnl} (98%) rename tools/{gen-docs.fnl => get-docs.fnl} (88%) rename tools/{gen-docs => get-docs}/lua-manual.fnl (100%) rename tools/{gen-docs => get-docs}/tic80.fnl (100%) delete mode 100644 tools/unvendor.fnl diff --git a/Makefile b/Makefile index 049d1e4..e262162 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ FENNELFLAGS+=--skip-include fennel.compiler EXTRA_FENNELFLAGS ?= FENNELFLAGS+= $(EXTRA_FENNELFLAGS) -.PHONY: all clean test install ci selfcheck +.PHONY: all clean test repl install docs install-deps ci selfcheck all: $(EXE) @@ -26,32 +26,36 @@ $(EXE): $(SRC) $(FENNEL) $(FENNELFLAGS) --require-as-include --compile src/fennel-ls.fnl >> $@ chmod 755 $@ -clean: - rm -f $(EXE) +repl: + $(FENNEL) $(FENNELFLAGS) + +docs: + $(FENNEL) $(FENNELFLAGS) tools/get-docs.fnl + +rm-docs: + rm -rf src/fennel-ls/docs/ + +deps: + $(FENNEL) $(FENNELFLAGS) tools/get-deps.fnl + +rm-deps: + rm -rf fennel deps/ + +selfcheck: + $(FENNEL) $(FENNELFLAGS) src/fennel-ls.fnl --check $(SRC) + +install: $(EXE) + mkdir -p $(DESTDIR)$(BINDIR) && cp $< $(DESTDIR)$(BINDIR)/ test: TESTING=1 $(FENNEL) $(FENNELFLAGS) test/init.fnl -repl: - $(FENNEL) $(FENNELFLAGS) - -testall: +ci: $(MAKE) test LUA=lua5.1 $(MAKE) test LUA=lua5.2 $(MAKE) test LUA=lua5.3 $(MAKE) test LUA=lua5.4 $(MAKE) test LUA=luajit -docs: - $(FENNEL) $(FENNELFLAGS) tools/gen-docs.fnl - -install-deps: - $(FENNEL) $(FENNELFLAGS) tools/vendor.fnl - -install: $(EXE) - mkdir -p $(DESTDIR)$(BINDIR) && cp $< $(DESTDIR)$(BINDIR)/ - -ci: testall $(EXE) - -selfcheck: - $(FENNEL) $(FENNELFLAGS) src/fennel-ls.fnl --check $(SRC) +clean: + rm -f $(EXE) diff --git a/tools/vendor.fnl b/tools/get-deps.fnl similarity index 98% rename from tools/vendor.fnl rename to tools/get-deps.fnl index 900ee23..c5cacc1 100644 --- a/tools/vendor.fnl +++ b/tools/get-deps.fnl @@ -12,7 +12,6 @@ (local dkjson-md5sum "94320e64e95f9bb5b06d9955e5391a78 build/dkjson.lua") (local dkjson-sha1sum "6926b65aa74ae8278b6c5923c0c5568af4f1fef1 build/dkjson.lua") -(sh :mkdir :-p "deps/") ;; get fennel (sh :mkdir :-p "build/") @@ -36,7 +35,8 @@ (assert (= 0 (sh :echo dkjson-md5sum [:|] :md5sum "--check --status"))) (assert (= 0 (sh :echo dkjson-sha1sum [:|] :sha1sum "--check --status")))) - +;; copy to the "deps" folder +(sh :mkdir :-p "deps/") (sh :cp "build/fennel/fennel" ".") (sh :cp "build/fennel/fennel.lua" "deps/") (sh :cp "build/faith/faith.fnl" "deps/") diff --git a/tools/gen-docs.fnl b/tools/get-docs.fnl similarity index 88% rename from tools/gen-docs.fnl rename to tools/get-docs.fnl index 3cdde15..29a6c90 100644 --- a/tools/gen-docs.fnl +++ b/tools/get-docs.fnl @@ -21,8 +21,9 @@ (fn main [] (sh :mkdir :-p "build/") - (let [{:convert lua-manual} (require :tools.gen-docs.lua-manual) - {:convert tic-manual} (require :tools.gen-docs.tic80)] + (sh :mkdir :-p "src/fennel-ls/docs/") + (let [{:convert lua-manual} (require :tools.get-docs.lua-manual) + {:convert tic-manual} (require :tools.get-docs.tic80)] (derive-docs-from-url "https://www.lua.org/manual/5.1/manual.html" "lua51.fnl" lua-manual) (derive-docs-from-url "https://www.lua.org/manual/5.2/manual.html" "lua52.fnl" lua-manual) (derive-docs-from-url "https://www.lua.org/manual/5.3/manual.html" "lua53.fnl" lua-manual) diff --git a/tools/gen-docs/lua-manual.fnl b/tools/get-docs/lua-manual.fnl similarity index 100% rename from tools/gen-docs/lua-manual.fnl rename to tools/get-docs/lua-manual.fnl diff --git a/tools/gen-docs/tic80.fnl b/tools/get-docs/tic80.fnl similarity index 100% rename from tools/gen-docs/tic80.fnl rename to tools/get-docs/tic80.fnl diff --git a/tools/unvendor.fnl b/tools/unvendor.fnl deleted file mode 100644 index ccf14cb..0000000 --- a/tools/unvendor.fnl +++ /dev/null @@ -1,7 +0,0 @@ -(local {: sh} (require :tools.util.sh)) - -(sh :rm :-rf - ;; delete vendored "fennel" (build dependency) - "fennel" - ;; delete deps folder - "deps/") diff --git a/tools/util/sh.fnl b/tools/util/sh.fnl index ebc89b7..4251fce 100644 --- a/tools/util/sh.fnl +++ b/tools/util/sh.fnl @@ -14,7 +14,7 @@ (string.gsub arg "'" "\\'") "'"))) " ")] - (print (.. "tools/gen-docs: " command)) + (print (.. "running command: " command)) (os.execute command))) {: sh}