Fork me on GitHub
#tools-deps
<
2018-11-03
>
lwhorton00:11:05

i want to report a big-ol THANK YOU to the hard work behind tools-deps. i just started a greenfield clojure project and was able to create an nrepl “reloaded” workflow using only 1. deps.edn file 2. makefile for convenience 3. cat. no more boot, no more lein (for now, still have to look at generating jars).

lwhorton00:11:23

is this what cleanliness feels like? have i found it?! troll

seancorfield00:11:10

I'll second that THANK YOU since we have essentially eliminated Boot from our primary Clojure workflow across all tiers (dev through QA through production) and we like the simplicity of it all.

borkdude10:11:05

@lwhorton mind sharing your deps.edn? I’m interested in enabling nREPL for a project so I don’t have to use lein

lwhorton16:11:34

sure:

:aliases {:dev {:extra-paths ["dev"]
                 :extra-deps {org.clojure/tools.namespace {:mvn/version "0.2.11"}
                              org.clojure/tools.deps.alpha {:mvn/version "0.5.460"}
                              nrepl/nrepl {:mvn/version "0.4.5"}
                              reply {:mvn/version "0.4.2"}}
                 :main-opts ["-m" "nrepl.cmdline"]}}}

lwhorton16:11:39

makefile:

NREPL_PORT=$(shell cat .nrepl-port)

dev:
	clj -A:dev
.PHONY: dev

clj-repl:
	clj -R:dev -m reply.main --attach $(NREPL_PORT)

lwhorton16:11:17

and my user.clj file (pulled in from the extra-paths in deps.edn):

(ns user
  (:require
    [ :as io]
    [clojure.tools.namespace.repl :refer [refresh refresh-all]]
    [clojure.pprint :refer [pprint]]
    [clojure.inspector :as i]
    [gerbil.core :as c]
    )
  )

(def ^:dynamic system nil)

(defn init []
  (alter-var-root #'system (constantly (c/system))))

(defn start []
  (alter-var-root #'system c/start))

(defn stop []
  (alter-var-root #'system
                  (fn [s] (when s (c/stop s)))))

(defn go []
  (init)
  (start))

(defn reset []
  (stop)
  (refresh :after 'user/go))

lwhorton16:11:05

you can drop the reply stuff if you want and just use nrepl’s “basic” client

cjohansen11:11:29

I'll third that THANK YOU! 👍

slipset12:11:51

@lwhorton juxt pack generates jars for you

orestis15:11:24

@borkdude

:cider-nrepl {:extra-deps {nrepl/nrepl {:mvn/version "0.4.5"}
                             cider/cider-nrepl {:mvn/version "0.18.0"}}
                :main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]}
  :nrepl {:extra-deps {nrepl/nrepl {:mvn/version "0.4.5"}
                       org.clojure/tools.nrepl {:mvn/version "0.2.13"}}
              :main-opts ["-m" "nrepl.cmdline"]}

orestis15:11:11

Here’s what I use to launch nREPL — the first variant is what I actually use to connect CIDER.

cap10morgan16:11:14

Asking this here too since it’s not really Datomic-specific: I have a datomic-pro download in a dir (so it has the datomic-pro-version.jar at the root, a lib subdir with deps jars, etc. I am trying to setup a tools-deps project to run some clojure code using datomic and all of its deps w/o triggering a download of them. Is there a more efficient way to do it than having to specify each individual jar in the :paths vector in deps.edn?

cap10morgan16:11:05

Answering my own question: :paths ["src" "/path/to/datomic/datomic-pro-version.jar" "/path/to/datomic/lib/*"] was the answer. (Not "/path/to/datomic/lib/" nor "/path/to/datomic/lib/*.jar")