You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
668 B

(ns leiningen.neo4j
(:import org.neo4j.server.CommunityBootstrapper
org.neo4j.test.TestGraphDatabaseFactory
java.lang.Thread
java.util.Optional)
(:require [clojure.java.io :as io]))
(defn neo4j
[project & args]
(let [path (io/as-file (get-in project [:neo4j :path] "target/neo4j"))
config (get-in project [:neo4j :config] {})
server (CommunityBootstrapper.)]
(.start server path (Optional/empty) config)
(while true (Thread/sleep 5000))))
(defn with-test-db [path do-with-db]
(let [db (.newImpermanentDatabase
(TestGraphDatabaseFactory.)
(io/as-file path))]
(do-with-db)))