]> Lady’s Gitweb - Vocab/commitdiff
Improve development setup
authorLady <redacted>
Thu, 31 Jul 2025 01:11:55 +0000 (21:11 -0400)
committerLady <redacted>
Thu, 31 Jul 2025 01:13:41 +0000 (21:13 -0400)
- A leading '%' can now be used to ignore files.

- `make serve` can be used to spin up a simple webserver.

.gitignore
GNUmakefile
scripts/serve.rb [new file with mode: 0755]

index e75c3580593953259406d4ad746ab4d6b00b67a5..f34112df8ddf15db2fc450a558e89acf041ee8ea 100644 (file)
@@ -4,3 +4,4 @@
 /build
 /public
 .grass
 /build
 /public
 .grass
+%*
index 72bf2926996a29f4d453ec0f6e8d07ad447c6c08..9be16461f60c50194486562139aa09d09d0b8d58 100644 (file)
@@ -34,7 +34,9 @@ SHUSHEOPTS := $(MAKEOPTS) SRCDIR='$(SRCDIR)' DATADIR='$(DATADIR)' BUILDDIR='$(BU
 YSEME := .πŸ‘₯πŸ“€
 YSEMEOPTS := $(MAKEOPTS) BUILDTARGET='$(BUILDTARGET)' DESTDIR='$(DESTDIR)' SERVERPATH='lady/vocab'
 
 YSEME := .πŸ‘₯πŸ“€
 YSEMEOPTS := $(MAKEOPTS) BUILDTARGET='$(BUILDTARGET)' DESTDIR='$(DESTDIR)' SERVERPATH='lady/vocab'
 
-xmls := $(wildcard $(DATADIR)/*/*)
+PORT := 3000
+
+xmls := $(wildcard $(DATADIR)/*/[0-9A-Za-z_]*) $(wildcard $(DATADIR)/*/Β¦*)
 
 # β” Β§ Call out to β›©πŸ“° δΉ¦η€Ύ β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”
 
 
 # β” Β§ Call out to β›©πŸ“° δΉ¦η€Ύ β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”β”
 
@@ -81,10 +83,14 @@ $(foreach xml,$(xmls),lint][$(xml)) : lint][% : .libxml2/xmllint
 
 .IGNORE : $(foreach xml,$(xmls),lint][$(xml)) ;
 
 
 .IGNORE : $(foreach xml,$(xmls),lint][$(xml)) ;
 
-.PHONY : FORCE build clean dry-sync gone lint $(foreach xml,$(xmls),lint][$(xml)) list prebuild sync uninstall ;
+.PHONY : FORCE build clean dry-sync gone lint $(foreach xml,$(xmls),lint][$(xml)) list prebuild serve sync uninstall ;
 
 gone : clean uninstall ;
 
 
 gone : clean uninstall ;
 
+serve :
+       @printf '%b\n' '\0033[1m\n\0033[7m NOTE: \0033[27m Visit <http://localhost:$(PORT)/> to view the site.\n\0033[7m       \0033[27m \n\0033[7m       \0033[27m Press control + C to exit.\n\0033[22m' >&2
+       @ruby ./scripts/serve.rb $(PORT) >&2
+
 uninstall :
        @for publicfile in $(patsubst %,"%",$(wildcard $(DESTDIR)/*)); do if $(GIT) check-ignore -q "$$publicfile"; then $(RM) -rf "$$publicfile"; fi; done
 
 uninstall :
        @for publicfile in $(patsubst %,"%",$(wildcard $(DESTDIR)/*)); do if $(GIT) check-ignore -q "$$publicfile"; then $(RM) -rf "$$publicfile"; fi; done
 
diff --git a/scripts/serve.rb b/scripts/serve.rb
new file mode 100755 (executable)
index 0000000..cf3b14a
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/ruby
+# SPDX-FileCopyrightText: 2025 Lady <https://www.ladys.computer/about/#lady>
+# SPDX-License-Identifier: CC0-1.0
+
+require "webrick"
+
+server = WEBrick::HTTPServer.new(Port: ARGV[0] || 3000, DocumentRoot: "public", DirectoryIndex: ["index.xhtml"])
+trap 'INT' do server.shutdown end
+
+class XHTMLHandler < WEBrick::HTTPServlet::DefaultFileHandler
+  def do_GET request, response
+    super
+    response['Content-Type'] = 'application/xhtml+xml'
+  end
+end
+WEBrick::HTTPServlet::FileHandler.add_handler("xhtml", XHTMLHandler)
+
+server.start
This page took 0.250593 seconds and 4 git commands to generate.