           line  (line-seq (io/reader h))
           :let  [sym (read-string line)]]
       (-> current-version
-        (->Ns  (namespace sym))
-        (->Def (name sym))))))
+         (->Ns  (namespace sym))
+         (->Def (name sym))))))

        handle (thing->meta-handle config thing)]
    (when (.exists handle) ;; guard against missing files
      (-> handle
        slurp
        (string/replace #"#<.*?>" "nil") ;; FIXME: Hack to ignore unreadable #<>s
        edn/read-string))))

(defmethod api/read-related :filesystem [config thing]
  ;; FIXME: This assumes the old Grimoire 0.3.X related file format,

            [clojure.edn :as edn]
            [version-clj.core :as semver]))

(defmacro throw-e [& forms]
  `(throw (Exception. (str ~@forms))))

;; List things
;;--------------------
(defmethod api/list-groups :filesystem [config]
  (let [handle (io/file (-> config :datastore :docs))]
    (if (.isDirectory handle)
      (for [d     (.listFiles handle)
            :when (.isDirectory d)]
        (->T :group nil (.getName d)))
      (throw
       (Exception.
        "Could not find store directory")))))

(defmethod api/list-artifacts :filesystem [config thing]
  (let [thing  (ensure-thing thing)
        thing  (thing->group thing)
        _      (assert thing)
        handle (thing->handle config :else thing)]
    (if (.isDirectory handle)
      (for [d     (.listFiles handle)
            :when (.isDirectory d)]
        (->T :artifact thing (.getName d)))
      (throw-e "No such group "
               (:uri thing)))))

(defmethod api/list-versions :filesystem [config thing]
  (let [thing    (ensure-thing thing)
        artifact (thing->artifact thing)
        _        (assert artifact)
        handle   (thing->handle config :else artifact)]
    (if (.isDirectory handle)
      (->> (for [d     (reverse (sort (.listFiles handle)))
               :when (.isDirectory d)]
           (->T :version artifact (.getName d)))
         (sort-by :name)
         reverse)
      (throw-e  "No such artifact "
                (:uri thing)))))

(defmethod api/list-namespaces :filesystem [config thing]
  (let [thing   (ensure-thing thing)
