Skip to content

Instantly share code, notes, and snippets.

@h4ssi
Created October 18, 2014 09:18
Show Gist options
  • Save h4ssi/8fd9457f2826088ae1cc to your computer and use it in GitHub Desktop.
Save h4ssi/8fd9457f2826088ae1cc to your computer and use it in GitHub Desktop.
Connect to vert.x 2.1.2 remote repl with Light Table
(ns example.core
(:require [vertx.core :as core]
[vertx.net :as net]
[vertx.stream :as stream]
[vertx.repl :as repl]
[vertx.logging :as log]
[lighttable.nrepl.handler :refer [lighttable-ops]]))
(def x "try manipulating me")
(defn print-x [] (log/info (str "x = " x)))
#_(print-x)
(defn init
[]
(let [server (net/server)]
; start nrepl server with Light Table middleware on port 9000
; in Light Table use
; Add Connection
; Clojure (remote nREPL) -> localhost:9000
(repl/start 9000 "127.0.0.1" :middleware [#'lighttable-ops])
(-> server
(net/on-connect #(do
(print-x)
(stream/pump % %)))
(net/listen 1234 "localhost"))
(core/on-stop
(.close server))))
(defproject
; ...
:dependencies [[org.clojure/clojure "1.6.0"]
[lein-light-nrepl "0.0.17"]] ; 0.0.18 did not work for me :(
; ...
:plugins [[lein-vertx "0.3.1"]] ; use $ lein vertx buildmod
; to build zip with deps
; use $ vertx runzip <built-zip>
; to run module
; ...
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment