Skip to content

Instantly share code, notes, and snippets.

@pjullah
Last active May 3, 2017 11:48
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 pjullah/745e6e957c2d31f4f4765034429f6fa0 to your computer and use it in GitHub Desktop.
Save pjullah/745e6e957c2d31f4f4765034429f6fa0 to your computer and use it in GitHub Desktop.
Notes on Clojure development environment configuration
;; https://stuartsierra.com/2016/clojure-how-to-ns.html
;; ns cheatsheet https://gist.github.com/ghoseb/287710/
;; Work with library in REPL - example Cheshire
(boot.core/set-env! :dependencies #(conj % '[cheshire "5.5.0"]))
(require '[cheshire.core])
;; add dependency
(set-env! :dependencies #(conj % '[foo/bar "1.2.3"]))
;;start repl in project namespace
(task-options!
repl {:init-ns 'cli.core
:eval '(print "Welcome \n")}
;; Make changes to files available to repl without restart
(require '[clojure.tools.namespace.repl :refer [refresh]])
(apply clojure.tools.namespace.repl/set-refresh-dirs (boot.core/get-env :directories))
boot.core => (clojure.tools.namespace.repl/refresh)
; for some reason, required to provide namespace despite previous require
;; Changes to files available to repl automatically
(deftask dev
""
[]
(comp
(repl :port repl-port )
(watch)
(speak)
(refresh)))
; then start a seperate REPL client
boot repl -c --port 5600
;; Add dependency without a REPL restart
boot.core => (set-env! :dependencies '[[group-id/artifact-id version-string]])
boot.core => (require '[dep :refer :all])
;; TODO Execute tests from within REPL
;; TODO Execute all tests when files change
;; TODO Only execute tests related to the changed files
(merge-env! :dependencies '[[foo/bar "1.0"] [baz "2.0"]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment