Updated specs to allow int and booleans.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Oliver Marks 2019-09-20 20:19:16 +01:00
parent 569c11f96e
commit 4b0784a673
8 changed files with 39 additions and 12 deletions

17
.drone.yml Normal file
View File

@ -0,0 +1,17 @@
kind: pipeline
name: default
steps:
- name: building-clojure-app
image: clojure:tools-deps
commands:
- ls -la
- clojure -m figwheel.main --build-once prod
- name: compress
image: alpine
commands:
- ls -la
- apk add gzip
- resources/public
- gzip * -k

5
deps.edn Normal file → Executable file
View File

@ -7,6 +7,7 @@
metosin/reitit {:mvn/version "0.3.1"}
venantius/accountant {:mvn/version "0.2.4"}
com.bhauman/figwheel-main {:mvn/version "0.2.1-SNAPSHOT"}
cider/piggieback {:mvn/version "0.4.0"}
cider/piggieback {:mvn/version "0.4.1-SNAPSHOT"}
com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}}
:paths ["src" "resources"]}
:paths ["resources" "src"]}

View File

@ -1,4 +1,3 @@
^{ :open-url "http://127.0.0.1:9500/prod.html"}
{:output-to "resources/public/main.js"
:optimizations :advanced
:main weecfg.core}

8
project.clj Normal file
View File

@ -0,0 +1,8 @@
(defproject weecfg "0.1.0-SNAPSHOT"
:uberjar-name "server.jar"
:target-path "target/%s"
:source-paths ["src" "src/clj" "src/cljs"]
:ring {:handler server-rendering.handler/app}
:plugins [[lein-tools-deps "0.4.5"] [lein-ring "0.12.5"]]
:middleware [lein-tools-deps.plugin/resolve-dependencies-with-deps-edn]
:lein-tools-deps/config {:config-files [:install :user :project]})

View File

@ -20,9 +20,12 @@ clojure -m figwheel.main --build dev --repl
#+END_SRC
#+BEGIN_SRC sh
clojure -m figwheel.main --build prod --repl
clojure -m figwheel.main --build prod
#+END_SRC
once running you should be able to see the app under the url below.
http://localhost:9500/
* Tips
** Android issue
If your using an android device and cant load the web page make sure you selected stay connect to wifi, android will show =Connect, with no internet" this is a bit misleading look for a notification and select stay connected with out this the web page will not show.

View File

@ -1,4 +1,4 @@
var CLOSURE_UNCOMPILED_DEFINES = {"figwheel.repl.connect_url":"ws:\/\/localhost:9500\/figwheel-connect?fwprocess=226ccd&fwbuild=dev"};
var CLOSURE_UNCOMPILED_DEFINES = {"figwheel.repl.connect_url":"ws:\/\/localhost:9500\/figwheel-connect?fwprocess=839c36&fwbuild=dev"};
var CLOSURE_NO_DEPS = true;
if(typeof goog == "undefined") document.write('<script src="/cljs-out/dev/goog/base.js"></script>');
document.write('<script src="/cljs-out/dev/goog/deps.js"></script>');

View File

@ -1,5 +1,5 @@
{:title "GASP Sensor setup"
:fields [{:name "server" :title "Server" :placeholder "127.0.0.1"
{:title "QA Keypad setup"
:fields [{:name "server" :title "Server Address" :placeholder "127.0.0.1"
:validator "server-type"
:error "Invalid server address"}
{:name "device-id" :title "Device Unique ID" :placeholder "AAAA"

View File

@ -9,13 +9,14 @@
; variables
(defonce form-errors (atom nil))
(defonce form-title "GASP Sensor setup")
(defonce form-title (atom "GASP Sensor setup"))
(defonce form-data (atom {:server "" :device-id "" :wifi-ssid "" :wifi-key ""}))
(defonce device-id-regex #"[A-Za-z0-9]{4}")
(defonce ssid-regex #"^[!#;].|[+\[\]\"\t\s].*$")
; spec validation definitions
(s/def ::boolean-type boolean?)
(s/def ::integer-type int?)
(s/def ::size-test #(<= (count %) 2))
(s/def ::ssid-size-limit #(<= (count %) 32))
(s/def ::default-size-limit #(<= (count %) 50))
@ -26,8 +27,6 @@
; page routes
(def router
(reitit/router
[["/" :index]
@ -90,7 +89,7 @@
(let [form (read-string response)
title (:title form)
fields (:fields form)]
(reset! form-fields form-title)
(reset! form-title title)
(reset! form-fields fields)))}))
;submit the data as raw post data
@ -161,7 +160,7 @@
[:a.link.fr.black.pt3.pb3 {:href (path-for :about)} [:i.fas.fa-question-circle]]
[:a.athelas.f3.link.white-70.hover-white.no-underline.flex.items-center.pa3
{:href "/"}
[:i.fas.fa-surprise.mr3.v-mid] "GASP Sensor setup"]]
[:i.fas.fa-surprise.mr3.v-mid] @form-title]]
[page]]])))
; sort out routing sessions and basically kickstart everything