Created
December 16, 2017 12:56
-
-
Save piotr-yuxuan/01772b2f376a1ffa595bbc8a2a675e34 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(require '[graph-fnk-viz :as viz] ;; git clone https://github.com/RedBrainLabs/graph-fnk-viz then lein install | |
'plumbing.graph | |
;; Namespaces of graphs | |
'…) | |
(def graphs | |
"Would be wonderful if these graphs would be programmatically found with static code analysis. | |
So we could run this snippet once in a while and store files in a doc/." | |
['…]) | |
(defn- os-specific-file-name | |
[would-be-name] | |
would-be-name) | |
(def save-directory "/tmp/graph-svg/") | |
(defn- graph-filename | |
[graph] | |
(os-specific-file-name (str save-directory graph ".svg"))) | |
(defn- graph->svg! | |
[graph] | |
(let [filename (graph-filename graph)] | |
(clojure.java.io/make-parents filename) | |
(println (name graph)) | |
(viz/save-svg (eval graph) filename))) | |
(defn- get-*pwd* | |
[] | |
(.getParent (java.io.File. *file*))) | |
(do | |
(println "Current directory: " (get-*pwd*)) | |
(doseq [g graphs] | |
(graph->svg! g))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment