From 4eeb9ea27f1f2f307071d3903463ba5c04d0a5f4 Mon Sep 17 00:00:00 2001 From: Dave Sann Date: Mon, 18 Feb 2013 21:48:45 +1100 Subject: [PATCH 1/2] Added :reload-paths to options This option allows users to specify which directories wrap-reload checks. See also: https://github.com/weavejester/lein-ring/issues/46 --- src/ring/server/standalone.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ring/server/standalone.clj b/src/ring/server/standalone.clj index 5b3a79c..75ebf35 100644 --- a/src/ring/server/standalone.clj +++ b/src/ring/server/standalone.clj @@ -57,7 +57,7 @@ (defn- add-auto-reload [handler options] (if (auto-reload? options) - (wrap-reload handler) + (wrap-reload handler {:dirs (:reload-paths options)}) handler)) (defn- add-auto-refresh [handler options] @@ -81,6 +81,7 @@ :browser-uri - the path to browse to when opening a browser :stacktraces? - if true, display stacktraces when an exception is thrown :auto-reload? - if true, automatically reload source files + :reload-paths - seq of src-paths to reload on change - defaults to [\"src\"] :auto-refresh? - if true, automatically refresh browser when source changes If join? is false, a Server object is returned." From 57567629a896c83f6a7c7961f8070496036070db Mon Sep 17 00:00:00 2001 From: Dave Sann Date: Mon, 18 Feb 2013 23:25:03 +1100 Subject: [PATCH 2/2] Ensure :reload-paths default to ["src"] --- README.md | 4 ++++ src/ring/server/options.clj | 4 ++++ src/ring/server/standalone.clj | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 290f19f..2f56b5d 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,10 @@ The following options are supported: True if you want your source files to be automatically reloaded when they are modified. Defaults to true in development, false in production. + +* `:reload-paths` - + A seq of source paths to reload. Defaults to [\"src\"]. + Only relevant if :auto-reload? is true. * `:auto-refresh?` - True if you want your browser to automatically refresh when source diff --git a/src/ring/server/options.clj b/src/ring/server/options.clj index 54a71a5..548b78a 100644 --- a/src/ring/server/options.clj +++ b/src/ring/server/options.clj @@ -36,3 +36,7 @@ "True if stacktraces should be shown for exceptions raised by the handler." [options] (:stacktraces? options dev-env?)) + +(defn reload-paths + [options] + (:reload-paths options ["src"])) diff --git a/src/ring/server/standalone.clj b/src/ring/server/standalone.clj index 75ebf35..5a77d9b 100644 --- a/src/ring/server/standalone.clj +++ b/src/ring/server/standalone.clj @@ -57,7 +57,7 @@ (defn- add-auto-reload [handler options] (if (auto-reload? options) - (wrap-reload handler {:dirs (:reload-paths options)}) + (wrap-reload handler {:dirs (reload-paths options)}) handler)) (defn- add-auto-refresh [handler options]