Added :auto-refresh? option
This commit is contained in:
parent
205bf14aa5
commit
1cebf407cf
|
@ -2,6 +2,7 @@
|
||||||
:description "Library for running Ring web servers"
|
:description "Library for running Ring web servers"
|
||||||
:dependencies [[org.clojure/clojure "1.2.1"]
|
:dependencies [[org.clojure/clojure "1.2.1"]
|
||||||
[org.clojure/core.incubator "0.1.0"]
|
[org.clojure/core.incubator "0.1.0"]
|
||||||
[ring "1.1.0"]]
|
[ring "1.1.0"]
|
||||||
|
[ring-refresh "0.1.0"]]
|
||||||
:plugins [[codox "0.6.1"]]
|
:plugins [[codox "0.6.1"]]
|
||||||
:profiles {:dev {:dependencies [[clj-http "0.4.1"]]}})
|
:profiles {:dev {:dependencies [[clj-http "0.4.1"]]}})
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
ring.server.options
|
ring.server.options
|
||||||
ring.middleware.stacktrace
|
ring.middleware.stacktrace
|
||||||
ring.middleware.reload
|
ring.middleware.reload
|
||||||
|
ring.middleware.refresh
|
||||||
[clojure.java.browse :only (browse-url)]))
|
[clojure.java.browse :only (browse-url)]))
|
||||||
|
|
||||||
(defn- try-port
|
(defn- try-port
|
||||||
|
@ -59,8 +60,14 @@
|
||||||
(wrap-reload handler)
|
(wrap-reload handler)
|
||||||
handler))
|
handler))
|
||||||
|
|
||||||
|
(defn- add-auto-refresh [handler options]
|
||||||
|
(if (:auto-refresh? options)
|
||||||
|
(wrap-refresh handler)
|
||||||
|
handler))
|
||||||
|
|
||||||
(defn- add-middleware [handler options]
|
(defn- add-middleware [handler options]
|
||||||
(-> handler
|
(-> handler
|
||||||
|
(add-auto-refresh options)
|
||||||
(add-stacktraces options)
|
(add-stacktraces options)
|
||||||
(add-auto-reload options)))
|
(add-auto-reload options)))
|
||||||
|
|
||||||
|
@ -73,6 +80,7 @@
|
||||||
:open-browser? - if true, open a web browser after the server starts
|
:open-browser? - if true, open a web browser after the server starts
|
||||||
:stacktraces? - if true, display stacktraces when an exception is thrown
|
:stacktraces? - if true, display stacktraces when an exception is thrown
|
||||||
:auto-reload? - if true, automatically reload source files
|
:auto-reload? - if true, automatically reload source files
|
||||||
|
:auto-refresh? - if true, automatically refresh browser when source changes
|
||||||
|
|
||||||
If join? is false, a Server object is returned."
|
If join? is false, a Server object is returned."
|
||||||
{:arglists '([handler] [handler options])}
|
{:arglists '([handler] [handler options])}
|
||||||
|
|
Reference in a new issue