Build releases via lein uberjar

- Run scripts/build.sh to build JAR from scratch.
- Added better fix for lein cljx/reloaded workflow conflict
This commit is contained in:
Nicholas Kariniemi 2014-11-29 15:58:21 +02:00
parent 414dceec8b
commit 830451372a
21 changed files with 34 additions and 25 deletions

6
.gitignore vendored
View file

@ -1,7 +1,7 @@
/target
/public/js/out
/public/js/grub.js
/public/js/grub.min.js
/resources/public/js/out
/resources/public/js/grub.js
/resources/public/js/grub.min.js
/lib
/classes
/checkouts

View file

@ -1,9 +0,0 @@
#!/bin/bash
rm -rf target
git pull
rm -rf dev
lein cljx
git checkout dev
lein cljsbuild once prod
lein run prod

View file

@ -1,7 +1,3 @@
(require '[cljx.repl-middleware :as cljx])
(reset! @#'cljx/cljx-load-rules {:clj cljx.rules/clj-rules})
@@#'cljx/install-cljx-load
(ns user
(:require [grub.core :as system]
[clojure.java.io :as io]

View file

@ -19,7 +19,9 @@
[cljs-uuid "0.0.4"]
[com.cognitect/transit-clj "0.8.259"]
[com.cognitect/transit-cljs "0.8.188"]]
:profiles {:uberjar {:aot :all}
:aliases {"cljx" ["with-profile" "cljx" "cljx"]}
:profiles {:cljx {}
:uberjar {:aot :all}
:dev {:source-paths ["dev"]
:dependencies [[midje "1.6.3"]
[org.clojure/tools.namespace "0.2.3"]
@ -29,12 +31,12 @@
[lein-ring "0.8.6"]
[com.keminglabs/cljx "0.4.0"]]
:cljsbuild {:builds {:dev {:source-paths ["src/cljs" "target/generated/cljs"]
:compiler {:output-dir "public/js/out"
:output-to "public/js/grub.js"
:compiler {:output-dir "resources/public/js/out"
:output-to "resources/public/js/grub.js"
:optimizations :none
:source-map true}}
:prod {:source-paths ["src/cljs" "target/generated/cljs"]
:compiler {:output-to "public/js/grub.min.js"
:compiler {:output-to "resources/public/js/grub.min.js"
:optimizations :advanced
:pretty-print false
:preamble ["react/react.min.js"]

View file

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

View file

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

19
scripts/build.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash
echo "# Removing old builds"
rm -rf target
rm resources/public/js/grub.js
rm resources/public/js/grub.min.js
rm -rf resources/public/js/out
echo ""
echo "$ lein cljx"
lein cljx &&
echo "" &&
echo "$ lein cljsbuild once dev" &&
lein cljsbuild once dev &&
echo "" &&
echo "$ lein cljsbuild once prod" &&
lein cljsbuild once prod &&
echo "" &&
echo "$ lein uberjar" &&
lein uberjar

View file

@ -1,13 +1,16 @@
(ns grub.core
(:gen-class)
(:require [grub.websocket :as ws]
[grub.db :as db]
[grub.state :as state]
[grub.sync :as sync]
[ring.middleware.file :as file]
[ring.middleware.resource :as resource]
[ring.middleware.content-type :as content-type]
[ring.util.response :as resp]
[org.httpkit.server :as httpkit]
[clojure.core.async :as a :refer [<! >! chan go]]
[clojure.pprint :as pprint]
[hiccup
[page :refer [html5]]
[page :refer [include-js include-css]]]
@ -82,14 +85,12 @@
(defn wrap-bounce-favicon [handler]
(fn [req]
(if (= [:get "/favicon.ico"] [(:request-method req) (:uri req)])
{:status 404
:headers {}
:body ""}
(resp/not-found "")
(handler req))))
(defn make-handler [{:keys [index states]} new-states-pub]
(-> (fn [req] "Not found")
(file/wrap-file "public")
(-> (fn [req] (resp/not-found "Not found"))
(resource/wrap-resource "public")
(content-type/wrap-content-type)
(handle-root index)
(handle-websocket states new-states-pub)