-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Miikka Koskinen
committed
Jul 22, 2019
0 parents
commit 4e5e9b8
Showing
4 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.cpcache/ | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# clj-nvd | ||
|
||
A sketch of using [lein-nvd](https://github.com/rm-hull/lein-nvd) with deps.edn. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{:deps {nvd-clojure {:mvn/version "1.1.1"} | ||
metosin/jsonista {:mvn/version "0.2.3"} | ||
org.clojure/tools.deps.alpha {:mvn/version "0.7.527" :exclusions [org.slf4j/slf4j-nop]}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
(ns clj-nvd.core | ||
(:require [clojure.java.io :as io] | ||
[clojure.tools.deps.alpha :as deps] | ||
[clojure.tools.deps.alpha.reader :as deps.reader] | ||
[jsonista.core :as json] | ||
[nvd.task.check] | ||
[nvd.task.purge-database] | ||
[nvd.task.update-database])) | ||
|
||
(defn make-classpath [] | ||
(let [lib-map (-> (deps.reader/read-deps [(io/file "deps.edn")]) | ||
(deps/resolve-deps nil))] | ||
(mapcat :paths (vals lib-map)))) | ||
|
||
(defn -main [command & args] | ||
(let [config (try | ||
(read-string (slurp "clj-nvd.edn")) | ||
(catch java.io.FileNotFoundException _ | ||
nil)) | ||
temp-file (java.io.File/createTempFile "clj-nvd" ".json") | ||
path (.getAbsolutePath temp-file) | ||
classpath (make-classpath) | ||
opts {:nvd config | ||
:classpath classpath | ||
:cmd-args args}] | ||
(spit path (json/write-value-as-string opts)) | ||
(case command | ||
"check" (nvd.task.check/-main path) | ||
"purge" (nvd.task.purge-database/-main path) | ||
"update" (nvd.task.update-database/-main path) | ||
(do | ||
(.println *err* (str "No such command: " command)) | ||
(System/exit 1))))) |