Tackling bit-rot

This commit is contained in:
Simon Brooke 2021-12-09 20:12:59 +00:00
parent b07f69fb51
commit 741c857a7a
No known key found for this signature in database
GPG key ID: A7A4F18D1D4DF987
10 changed files with 54 additions and 46 deletions

3
.gitignore vendored
View file

@ -5,10 +5,13 @@
pom.xml pom.xml
*.jar *.jar
*.class *.class
/.calva/
/.lein-* /.lein-*
/.env /.env
*.log *.log
.nrepl-port
# Links to other places: # Links to other places:
resources/public/docs/mw-*/uberdoc.html resources/public/docs/mw-*/uberdoc.html
# Artefacts: # Artefacts:

View file

@ -1,49 +1,49 @@
(defproject mw-ui "0.1.6-SNAPSHOT" (defproject mw-ui "0.1.6-SNAPSHOT"
:description "Web-based user interface for MicroWorld" :description "Web-based user interface for MicroWorld"
:url "http://www.journeyman.cc/microworld" :dependencies [[org.clojure/clojure "1.10.3"]
:manifest {
"build-signature-version" "unset"
"build-signature-user" "unset"
"build-signature-email" "unset"
"build-signature-timestamp" "unset"
"Implementation-Version" "unset"
}
:dependencies [[org.clojure/clojure "1.8.0"]
[mw-engine "0.1.6-SNAPSHOT"] [mw-engine "0.1.6-SNAPSHOT"]
[mw-parser "0.1.6-SNAPSHOT"] [mw-parser "0.1.6-SNAPSHOT"]
[lib-noir "0.9.9"] [lib-noir "0.9.9"]
[ring-server "0.5.0"] [ring-server "0.5.0"]
[selmer "1.12.25"] [selmer "1.12.45"]
[hiccup "1.0.5"] [hiccup "1.0.5"]
[com.taoensso/timbre "4.10.0"] [com.taoensso/timbre "5.1.2"]
[com.taoensso/tower "3.0.2"] [com.taoensso/tower "3.0.2"]
[markdown-clj "1.10.4"] [markdown-clj "1.10.7"]
[environ "1.2.0"] [environ "1.2.0"]
[noir-exception "0.2.5"]] [noir-exception "0.2.5"]]
:docker {:image-name "simonbrooke/microworld"
:dockerfile "Dockerfile"}
:main mw-ui.repl
:manifest {"build-signature-version" "0.1.6-SNAPSHOT"
"build-signature-user" "Simon Brooke"
"build-signature-email" "unset"
"build-signature-timestamp" "2021-05-17 13:31:22+01:00"
"Implementation-Version" "0.1.6-SNAPSHOT built by Simon Brooke on 2021-05-17 13:31:22+01:00"}
:min-lein-version "2.0.0"
:repl-options {:init-ns mw-ui.repl}
:plugins [[lein-ring "0.8.11"] :plugins [[lein-ring "0.8.11"]
[lein-environ "0.5.0"] [lein-environ "0.5.0"]
[lein-marginalia "0.7.1"] [lein-marginalia "0.7.1"]
[io.sarnowski/lein-docker "1.1.0"]] [io.sarnowski/lein-docker "1.1.0"]]
:docker {:image-name "simonbrooke/microworld"
:dockerfile "Dockerfile"}
:ring {:handler mw-ui.handler/app
:init mw-ui.handler/init
:destroy mw-ui.handler/destroy
:resources-path "resources"
:war-resources-path "war-resources"
:uberwar-name "microworld.war"
}
:profiles :profiles
{:uberjar {:aot :all} {:uberjar {:aot :all}
:production {:ring {:open-browser? false :production {:ring {:open-browser? false
:stacktraces? false :stacktraces? false
:auto-reload? false}} :auto-reload? false}}
:dev {:dependencies [[ring-mock "0.1.5"] :dev {:dependencies [[ring-mock "0.1.5"]
[ring/ring-devel "1.8.1"] [ring/ring-devel "1.9.4"]
[pjstadig/humane-test-output "0.10.0"]] [pjstadig/humane-test-output "0.11.0"]]
:injections [(require 'pjstadig.humane-test-output) :injections [(require 'pjstadig.humane-test-output)
(pjstadig.humane-test-output/activate!)] (pjstadig.humane-test-output/activate!)]
:env {:dev true}}} :env {:dev true}}}
:min-lein-version "2.0.0") :repl-options {:init-ns mw-ui.repl}
:ring {:handler mw-ui.handler/app
:init mw-ui.handler/init
:destroy mw-ui.handler/destroy
:resources-path "resources"
:war-resources-path "war-resources"
:uberwar-name "microworld.war"}
:url "http://www.journeyman.cc/microworld"
)

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

View file

@ -0,0 +1,4 @@
;; 'run once' ruleset to be run after (e.g.) settlement to establish harbours
;; Doesn't work yet, need to find out why and fix it!
if state is water and more than four neighbours are not water and some neighbours are house then state should be harbour

View file

@ -8,7 +8,7 @@
[noir.util.middleware :refer [app-handler]] [noir.util.middleware :refer [app-handler]]
[compojure.route :as route] [compojure.route :as route]
[taoensso.timbre :as timbre] [taoensso.timbre :as timbre]
[taoensso.timbre.appenders.rotor :as rotor] ;; [taoensso.timbre.appenders.rotor :as rotor]
[selmer.parser :as parser] [selmer.parser :as parser]
[environ.core :refer [env]])) [environ.core :refer [env]]))
@ -46,19 +46,19 @@
an app server such as Tomcat an app server such as Tomcat
put any initialization code here" put any initialization code here"
[] []
(timbre/set-config! ;; (timbre/set-config!
[:appenders :rotor] ;; [:appenders :rotor]
{:min-level :info ;; {:min-level :info
:enabled? true ;; :enabled? true
:async? false ; should be always false for rotor ;; :async? false ; should be always false for rotor
:max-message-per-msecs nil ;; :max-message-per-msecs nil
:fn rotor/appender-fn}) ;; :fn rotor/appender-fn})
(timbre/set-config! ;; (timbre/set-config!
[:shared-appender-config :rotor] ;; [:shared-appender-config :rotor]
{:path "mw_ui.log" :max-size (* 512 1024) :backlog 10}) ;; {:path "mw_ui.log" :max-size (* 512 1024) :backlog 10})
(if (env :dev) (parser/cache-off!)) (when (env :dev) (parser/cache-off!))
(timbre/info "mw-ui started successfully")) (timbre/info "mw-ui started successfully"))

View file

@ -1,12 +1,11 @@
(ns ^{:doc "In truth, boilerplate from Luminus." (ns ^{:doc "In truth, boilerplate from Luminus."
:author "Simon Brooke"} :author "Simon Brooke"}
mw-ui.middleware mw-ui.middleware
(:require [taoensso.timbre :as timbre] (:require [taoensso.timbre :as timbre]
[selmer.parser :as parser]
[environ.core :refer [env]] [environ.core :refer [env]]
[selmer.middleware :refer [wrap-error-page]] [selmer.middleware :refer [wrap-error-page]]
[noir-exception.core [noir-exception.core
:refer [wrap-internal-error wrap-exceptions]])) :refer [wrap-internal-error wrap-exceptions]]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; ;;;;

View file

@ -1,9 +1,10 @@
(ns ^{:doc "In truth, boilerplate from Luminus." (ns ^{:doc "In truth, boilerplate from Luminus."
:author "Simon Brooke"} :author "Simon Brooke"}
mw-ui.repl mw-ui.repl
(:use mw-ui.handler (:require [mw-ui.handler :as handler]
ring.server.standalone [ring.server.standalone :refer [serve]]
[ring.middleware file-info file]) [ring.middleware.file :refer [wrap-file]]
[ring.middleware.file-info :refer [wrap-file-info]])
(:gen-class)) (:gen-class))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -37,7 +38,7 @@
;; the server is forced to re-resolve the symbol in the var ;; the server is forced to re-resolve the symbol in the var
;; rather than having its own copy. When the root binding ;; rather than having its own copy. When the root binding
;; changes, the server picks it up without having to restart. ;; changes, the server picks it up without having to restart.
(-> #'app (-> #'handler/app
; Makes static assets in $PROJECT_DIR/resources/public/ available. ; Makes static assets in $PROJECT_DIR/resources/public/ available.
(wrap-file "resources") (wrap-file "resources")
; Content-Type, Content-Length, and Last Modified headers for files in body ; Content-Type, Content-Length, and Last Modified headers for files in body
@ -50,9 +51,9 @@
(reset! server (reset! server
(serve (get-handler) (serve (get-handler)
{:port port {:port port
:init init :init handler/init
:auto-reload? true :auto-reload? true
:destroy destroy :destroy handler/destroy
:join? false})) :join? false}))
(println (str "You can view the site at http://localhost:" port)))) (println (str "You can view the site at http://localhost:" port))))
@ -62,3 +63,4 @@
(defn -main [] (defn -main []
(start-server)) (start-server))