Parse required clojure version out of project.clj to avoid duplication.
This commit is contained in:
parent
a987607134
commit
8a9a957a62
@ -1,4 +1,4 @@
|
||||
(defproject functional-koans "0.1.0"
|
||||
(defproject functional-koans "0.2.0"
|
||||
:description "The functional koans"
|
||||
:dependencies [[org.clojure/clojure "1.3.0-alpha3"]
|
||||
[jline "0.9.94"]])
|
||||
|
@ -1,6 +1,7 @@
|
||||
(ns path-to-enlightenment
|
||||
(:use [clojure.test])
|
||||
(:require [clojure.set]))
|
||||
(:require [clojure.set]
|
||||
[clojure.string]))
|
||||
|
||||
(def __ nil)
|
||||
(def ___ (fn [& args] nil))
|
||||
@ -37,7 +38,20 @@
|
||||
(throw (Exception. (str "Clojure version " required-major "."
|
||||
required-minor " or higher required."))))))
|
||||
|
||||
(defn parse-required-version []
|
||||
(let [rdr (clojure.lang.LineNumberingPushbackReader.
|
||||
(java.io.FileReader. (java.io.File. "project.clj")))
|
||||
project-form (read rdr)
|
||||
version-string (->> project-form
|
||||
(drop 3)
|
||||
(apply hash-map)
|
||||
:dependencies
|
||||
(into {})
|
||||
('org.clojure/clojure))]
|
||||
(map read-string
|
||||
(take 3 (clojure.string/split version-string #"[\.\-]")))))
|
||||
|
||||
(defn run []
|
||||
(require-version [1 3])
|
||||
(require-version (parse-required-version))
|
||||
(apply load (doall (map (partial str "koans/") ordered-koans)))
|
||||
(println "You have achieved clojure enlightenment. Namaste."))
|
||||
|
Loading…
Reference in New Issue
Block a user