Skip to content

Instantly share code, notes, and snippets.

@neupsh
Created December 8, 2016 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neupsh/0f2448719e7cc3de71461ae6b66f284c to your computer and use it in GitHub Desktop.
Save neupsh/0f2448719e7cc3de71461ae6b66f284c to your computer and use it in GitHub Desktop.
gorilla-repl boot task with cider middleware (not complete)
;;------------------------------------------------
;; just paste this in ~/.boot/profile.boot
;; and run:
;; boot gorilla
;;------------------------------------------------
(deftask gorilla
"Run a Gorilla REPL."
[p port PORT int "The port to run the web REPL on. Defaults to 4000."
i ip IP str "The IP address the server listens on. Defaults to 127.0.0.1"
n nrepl-port PORT int "The port that the nREPL server will be started up on. Defaults to a free port."
b block bool "Blocking (for standalone use)"
c cider bool "Inject Cider nrepl middleware. Defaults to true"]
(let [gorilla-pod (boot.pod/make-pod (get-env))
ip (or ip "127.0.01")
port (or port 4000)
nrepl-port (or nrepl-port 0)
block (or block true)
cider (or cider true)]
(comp
(with-pre-wrap fileset
(boot.pod/pod-name gorilla-pod "gorilla-pod")
(boot.pod/with-eval-in gorilla-pod
(boot.pod/add-dependencies (assoc boot.pod/env :dependencies '[[gorilla-repl "0.3.6"]]))
(if ~cider (boot.pod/add-dependencies
(assoc boot.pod/env :dependencies
'[[org.clojure/tools.nrepl "0.2.12"]
[cider/cider-nrepl "0.15.0-SNAPSHOT"]
[refactor-nrepl "2.2.0"]])))
(require '[gorilla-repl.core :as g]
'[boot.util :as u])
(g/run-gorilla-server {:port ~port
:ip ~ip
:nrepl-port ~nrepl-port
:project "boot-gorilla"})
(u/info "<< started Gorilla REPL on http://localhost:%d >>\n" ~port))
fileset)
(if block
(boot.task.built-in/wait)
identity))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment