timgilbert / depify

Creates or updates your deps.edn file, based on your project’s project.clj

Repository from Github https://github.comtimgilbert/depifyRepository from Github https://github.comtimgilbert/depify

Depify

What?

Creates or updates your deps.edn file, based on your project’s project.clj.

Usage

You can invoke it “over the air” as follows:

curl -sq https://raw.githubusercontent.com/hagmonk/depify/master/src/depify/project.clj | clj -

Or, create an alias in your ~/.clojure/deps.edn map:

:depify {:extra-deps {org.clojure/clojure {:mvn/version "1.9.0"}
                      depify              {:git/url "https://github.com/hagmonk/depify"
                                           :sha     "5bd166f0191cc8d57eecb36e50a6196de3991dea"}}
         :main-opts  ["-m" "depify.project"]}
:zprint {:extra-deps {org.clojure/clojure {:mvn/version "1.9.0"}
                      zprint              {:mvn/version "0.4.9"}}
         :main-opts  ["-m" "zprint.main"]}

Notice here I also have zprint as an alias, enabling this from your project folder:

clj -A:depify | clj -A:zprint > deps.edn.tmp ; mv deps.edn.tmp deps.edn

Note: depify will merge its results into any pre-existing deps.edn file in your project folder, but also print the result to stdout. Also, the “Stream closed” exception emitted by zprint can be safely ignored.

Surgeon General’s Warning

Running arbitrary Clojure code from an arbitrary URL on the internet is known to cause cancer. But hey, if it feels good, go ahead and do it.

About

Based on the initial concept in this gist by Sean Walker. Depify improves on it slightly:

Adds entries to existing deps.edn (replacing keys) rather than overwriting file

Handles variable unquoting in project.clj

project.clj

(def something "0.1.2")
(defproject foobar
  :dependencies [[something/gizmo ~something]])

deps.edn

{:deps #:something{gizmo #:mvn{:version "0.1.2"}}}

Handles extra fields, with an extension point so other keys can be added over time

project.clj

(defproject foobar
  :respositories [["dracular" "https//transy.edu"]]
  :dependencies [[something/gizmo "9.9.9"]
                 [org.apache/another-database "1.2.3" :exclusions [logging-nightmare]]]
  :jvm-opts ["-XX:+EnormousBiceps"])

deps.edn

{:deps
 {something/gizmo #:mvn{:version "9.9.9"},
  org.apache/another-database
  {:mvn/version "1.2.3", :exclusions [logging-nightmare]}},
 :jvm-opts ["-XX:+EnormousBiceps"]}

About

Creates or updates your deps.edn file, based on your project’s project.clj


Languages

Language:Clojure 100.0%