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 /target
/public/js/out /resources/public/js/out
/public/js/grub.js /resources/public/js/grub.js
/public/js/grub.min.js /resources/public/js/grub.min.js
/lib /lib
/classes /classes
/checkouts /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 (ns user
(:require [grub.core :as system] (:require [grub.core :as system]
[clojure.java.io :as io] [clojure.java.io :as io]

View file

@ -19,7 +19,9 @@
[cljs-uuid "0.0.4"] [cljs-uuid "0.0.4"]
[com.cognitect/transit-clj "0.8.259"] [com.cognitect/transit-clj "0.8.259"]
[com.cognitect/transit-cljs "0.8.188"]] [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"] :dev {:source-paths ["dev"]
:dependencies [[midje "1.6.3"] :dependencies [[midje "1.6.3"]
[org.clojure/tools.namespace "0.2.3"] [org.clojure/tools.namespace "0.2.3"]
@ -29,12 +31,12 @@
[lein-ring "0.8.6"] [lein-ring "0.8.6"]
[com.keminglabs/cljx "0.4.0"]] [com.keminglabs/cljx "0.4.0"]]
:cljsbuild {:builds {:dev {:source-paths ["src/cljs" "target/generated/cljs"] :cljsbuild {:builds {:dev {:source-paths ["src/cljs" "target/generated/cljs"]
:compiler {:output-dir "public/js/out" :compiler {:output-dir "resources/public/js/out"
:output-to "public/js/grub.js" :output-to "resources/public/js/grub.js"
:optimizations :none :optimizations :none
:source-map true}} :source-map true}}
:prod {:source-paths ["src/cljs" "target/generated/cljs"] :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 :optimizations :advanced
:pretty-print false :pretty-print false
:preamble ["react/react.min.js"] :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 (ns grub.core
(:gen-class)
(:require [grub.websocket :as ws] (:require [grub.websocket :as ws]
[grub.db :as db] [grub.db :as db]
[grub.state :as state] [grub.state :as state]
[grub.sync :as sync] [grub.sync :as sync]
[ring.middleware.file :as file] [ring.middleware.file :as file]
[ring.middleware.resource :as resource]
[ring.middleware.content-type :as content-type] [ring.middleware.content-type :as content-type]
[ring.util.response :as resp] [ring.util.response :as resp]
[org.httpkit.server :as httpkit] [org.httpkit.server :as httpkit]
[clojure.core.async :as a :refer [<! >! chan go]] [clojure.core.async :as a :refer [<! >! chan go]]
[clojure.pprint :as pprint]
[hiccup [hiccup
[page :refer [html5]] [page :refer [html5]]
[page :refer [include-js include-css]]] [page :refer [include-js include-css]]]
@ -82,14 +85,12 @@
(defn wrap-bounce-favicon [handler] (defn wrap-bounce-favicon [handler]
(fn [req] (fn [req]
(if (= [:get "/favicon.ico"] [(:request-method req) (:uri req)]) (if (= [:get "/favicon.ico"] [(:request-method req) (:uri req)])
{:status 404 (resp/not-found "")
:headers {}
:body ""}
(handler req)))) (handler req))))
(defn make-handler [{:keys [index states]} new-states-pub] (defn make-handler [{:keys [index states]} new-states-pub]
(-> (fn [req] "Not found") (-> (fn [req] (resp/not-found "Not found"))
(file/wrap-file "public") (resource/wrap-resource "public")
(content-type/wrap-content-type) (content-type/wrap-content-type)
(handle-root index) (handle-root index)
(handle-websocket states new-states-pub) (handle-websocket states new-states-pub)