~severeoverfl0w/wedge-mise

ref: 670720d43c24495284dcce1db98cdd4269109b6e wedge-mise/src/io/dominic/wedge/mise/rebel.clj -rw-r--r-- 1.0 KiB
670720d4 — Dominic Monroe Add nREPL support 1 year, 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
(ns io.dominic.wedge.mise.rebel
  (:require
    [clojure.tools.deps.alpha.repl :as tda.repl]
    [io.dominic.wedge.mise :as mise]
    [io.dominic.wedge.mise.impl.nrepl :as nrepl]))

(defn- add-libs
  []
  (binding [;; Suppress missing S3Transport warning
            *err* (java.io.StringWriter.)]
    (tda.repl/add-libs
      (cond->
        '{com.bhauman/rebel-readline {:mvn/version "0.1.4"}
          mvxcvi/puget {:mvn/version "1.3.1"}}
        (try (require 'cljs.analyzer)
             true
             (catch java.io.FileNotFoundException _
               false))
        (assoc 'com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}))))
  :loaded)

(defn -main
  [& args]
  (let [cl (.getContextClassLoader (Thread/currentThread))]
    (.setContextClassLoader (Thread/currentThread) (clojure.lang.DynamicClassLoader. cl)))
  (mise/load-libs)
  (mise/setup)
  (when (some #{"--nrepl"} args)
    (nrepl/add-libs)
    (nrepl/start-nrepl))
  (add-libs)
  (load "io/dominic/wedge/mise/rebel/impl")
  ((resolve 'main*)))