From 830451372ac20b16387ea8af984d31ced5bb7cfb Mon Sep 17 00:00:00 2001 From: Nicholas Kariniemi Date: Sat, 29 Nov 2014 15:58:21 +0200 Subject: [PATCH] Build releases via lein uberjar - Run scripts/build.sh to build JAR from scratch. - Added better fix for lein cljx/reloaded workflow conflict --- .gitignore | 6 +++--- deploy.sh | 9 --------- dev/user.clj | 4 ---- project.clj | 10 +++++---- .../public}/css/bootstrap-theme.css | 0 .../public}/css/bootstrap-theme.css.map | 0 .../public}/css/bootstrap-theme.min.css | 0 .../public}/css/bootstrap.css | 0 .../public}/css/bootstrap.css.map | 0 .../public}/css/bootstrap.min.css | 0 {public => resources/public}/css/styles.css | 0 .../fonts/glyphicons-halflings-regular.eot | Bin .../fonts/glyphicons-halflings-regular.svg | 0 .../fonts/glyphicons-halflings-regular.ttf | Bin .../fonts/glyphicons-halflings-regular.woff | Bin .../img/glyphicons-halflings-white.png | Bin .../public}/img/glyphicons-halflings.png | Bin .../public}/js/react-0.11.2-with-addons.js | 0 .../public}/js/react-0.11.2.js | 0 scripts/build.sh | 19 ++++++++++++++++++ src/clj/grub/core.clj | 11 +++++----- 21 files changed, 34 insertions(+), 25 deletions(-) delete mode 100755 deploy.sh rename {public => resources/public}/css/bootstrap-theme.css (100%) rename {public => resources/public}/css/bootstrap-theme.css.map (100%) rename {public => resources/public}/css/bootstrap-theme.min.css (100%) rename {public => resources/public}/css/bootstrap.css (100%) rename {public => resources/public}/css/bootstrap.css.map (100%) rename {public => resources/public}/css/bootstrap.min.css (100%) rename {public => resources/public}/css/styles.css (100%) rename {public => resources/public}/fonts/glyphicons-halflings-regular.eot (100%) rename {public => resources/public}/fonts/glyphicons-halflings-regular.svg (100%) rename {public => resources/public}/fonts/glyphicons-halflings-regular.ttf (100%) rename {public => resources/public}/fonts/glyphicons-halflings-regular.woff (100%) rename {public => resources/public}/img/glyphicons-halflings-white.png (100%) rename {public => resources/public}/img/glyphicons-halflings.png (100%) rename {public => resources/public}/js/react-0.11.2-with-addons.js (100%) rename {public => resources/public}/js/react-0.11.2.js (100%) create mode 100755 scripts/build.sh diff --git a/.gitignore b/.gitignore index 715d28e..d23278c 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/deploy.sh b/deploy.sh deleted file mode 100755 index bcfbc0b..0000000 --- a/deploy.sh +++ /dev/null @@ -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 diff --git a/dev/user.clj b/dev/user.clj index fb3ee08..3fd1eed 100644 --- a/dev/user.clj +++ b/dev/user.clj @@ -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] diff --git a/project.clj b/project.clj index 3f8fb19..46576c1 100644 --- a/project.clj +++ b/project.clj @@ -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"] diff --git a/public/css/bootstrap-theme.css b/resources/public/css/bootstrap-theme.css similarity index 100% rename from public/css/bootstrap-theme.css rename to resources/public/css/bootstrap-theme.css diff --git a/public/css/bootstrap-theme.css.map b/resources/public/css/bootstrap-theme.css.map similarity index 100% rename from public/css/bootstrap-theme.css.map rename to resources/public/css/bootstrap-theme.css.map diff --git a/public/css/bootstrap-theme.min.css b/resources/public/css/bootstrap-theme.min.css similarity index 100% rename from public/css/bootstrap-theme.min.css rename to resources/public/css/bootstrap-theme.min.css diff --git a/public/css/bootstrap.css b/resources/public/css/bootstrap.css similarity index 100% rename from public/css/bootstrap.css rename to resources/public/css/bootstrap.css diff --git a/public/css/bootstrap.css.map b/resources/public/css/bootstrap.css.map similarity index 100% rename from public/css/bootstrap.css.map rename to resources/public/css/bootstrap.css.map diff --git a/public/css/bootstrap.min.css b/resources/public/css/bootstrap.min.css similarity index 100% rename from public/css/bootstrap.min.css rename to resources/public/css/bootstrap.min.css diff --git a/public/css/styles.css b/resources/public/css/styles.css similarity index 100% rename from public/css/styles.css rename to resources/public/css/styles.css diff --git a/public/fonts/glyphicons-halflings-regular.eot b/resources/public/fonts/glyphicons-halflings-regular.eot similarity index 100% rename from public/fonts/glyphicons-halflings-regular.eot rename to resources/public/fonts/glyphicons-halflings-regular.eot diff --git a/public/fonts/glyphicons-halflings-regular.svg b/resources/public/fonts/glyphicons-halflings-regular.svg similarity index 100% rename from public/fonts/glyphicons-halflings-regular.svg rename to resources/public/fonts/glyphicons-halflings-regular.svg diff --git a/public/fonts/glyphicons-halflings-regular.ttf b/resources/public/fonts/glyphicons-halflings-regular.ttf similarity index 100% rename from public/fonts/glyphicons-halflings-regular.ttf rename to resources/public/fonts/glyphicons-halflings-regular.ttf diff --git a/public/fonts/glyphicons-halflings-regular.woff b/resources/public/fonts/glyphicons-halflings-regular.woff similarity index 100% rename from public/fonts/glyphicons-halflings-regular.woff rename to resources/public/fonts/glyphicons-halflings-regular.woff diff --git a/public/img/glyphicons-halflings-white.png b/resources/public/img/glyphicons-halflings-white.png similarity index 100% rename from public/img/glyphicons-halflings-white.png rename to resources/public/img/glyphicons-halflings-white.png diff --git a/public/img/glyphicons-halflings.png b/resources/public/img/glyphicons-halflings.png similarity index 100% rename from public/img/glyphicons-halflings.png rename to resources/public/img/glyphicons-halflings.png diff --git a/public/js/react-0.11.2-with-addons.js b/resources/public/js/react-0.11.2-with-addons.js similarity index 100% rename from public/js/react-0.11.2-with-addons.js rename to resources/public/js/react-0.11.2-with-addons.js diff --git a/public/js/react-0.11.2.js b/resources/public/js/react-0.11.2.js similarity index 100% rename from public/js/react-0.11.2.js rename to resources/public/js/react-0.11.2.js diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..b63151e --- /dev/null +++ b/scripts/build.sh @@ -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 diff --git a/src/clj/grub/core.clj b/src/clj/grub/core.clj index f731c7b..7c39fbf 100644 --- a/src/clj/grub/core.clj +++ b/src/clj/grub/core.clj @@ -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)