Skip to content

Commit

Permalink
resolve jetty at runtime so that it can be excluded as a dependency a…
Browse files Browse the repository at this point in the history
…nd inc version to alpha5

Signed-off-by: Chris Granger <ibdknox@gmail.com>
  • Loading branch information
ibdknox committed Jan 29, 2012
1 parent 6c0f328 commit cedfc18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion project.clj
@@ -1,4 +1,4 @@
(defproject noir "1.3.0-alpha4"
(defproject noir "1.3.0-alpha5"
:description "Noir - a clojure web framework"
:dependencies [[org.clojure/clojure "1.3.0"]
[compojure "1.0.0"]
Expand Down
9 changes: 6 additions & 3 deletions src/noir/server.clj
Expand Up @@ -5,7 +5,6 @@
[clojure.tools.namespace :only [find-namespaces-in-dir find-namespaces-on-classpath]]
[ring.middleware.multipart-params])
(:require [compojure.handler :as compojure]
[ring.adapter.jetty :as jetty]
[noir.server.handler :as handler]))

(defn gen-handler
Expand Down Expand Up @@ -66,9 +65,13 @@
:session-store - an alternate store for session handling
:session-cookie-attrs - custom session cookie attributes"
[port & [opts]]
;; to allow for jetty to be excluded as a dependency, it is included
;; here inline.
(require 'ring.adapter.jetty)
(println "Starting server...")
(let [jetty-opts (merge {:port port :join? false} (:jetty-options opts))
server (jetty/run-jetty (gen-handler opts) jetty-opts)]
(let [run-fn (resolve 'ring.adapter.jetty/run-jetty) ;; force runtime resolution of jetty
jetty-opts (merge {:port port :join? false} (:jetty-options opts))
server (run-fn (gen-handler opts) jetty-opts)]
(println (str "Server started on port [" port "]."))
(println (str "You can view the site at http://localhost:" port))
server))
Expand Down

0 comments on commit cedfc18

Please sign in to comment.