Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do the reloading workflow via tools.namespace stuff
- Loading branch information
Showing
4 changed files
with
72 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
web: lein repl :headless | ||
web: lein with-profile +nrepl repl :headless | ||
sass: sass --watch src/scss:resources/public/css | ||
cljs: lein trampoline cljsbuild auto dev | ||
mongo: mongod | ||
|
||
# Refresh 1st tab of chrome when fs changes are seen | ||
refresher: lein run -m tools.refresher chrome src/clj src/md resources | ||
refresher: lein run -m tools.refresher chrome src/md resources |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
(ns user | ||
(:require [clojure.tools.namespace.repl | ||
:refer (refresh refresh-all)] | ||
[clojuredocs.main] | ||
[clojure.java.shell :as sh])) | ||
|
||
(defn refresh-chrome | ||
"Refreshes first tab of chrome" | ||
[] | ||
(->> ["osascript" | ||
"tell application \"Google Chrome\" to tell the first tab of its first window" | ||
"reload" | ||
"end tell"] | ||
(interpose "-e") | ||
(apply sh/sh))) | ||
|
||
(defonce system nil) | ||
|
||
(defn init [] | ||
(alter-var-root #'system | ||
(constantly (clojuredocs.main/create-app)))) | ||
|
||
(defn start [] | ||
(alter-var-root #'system clojuredocs.main/start)) | ||
|
||
(defn stop [] | ||
(alter-var-root #'system | ||
(fn [s] | ||
(when s | ||
(clojuredocs.main/stop s))))) | ||
|
||
(defn go [] | ||
(init) | ||
(start) | ||
(refresh-chrome)) | ||
|
||
(defn restart [] | ||
(stop) | ||
(refresh :after 'user/go)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters