                (project-short project))})
 
 (defn get-project [project-name]
-  (-> @projects
-      (get project-name)
-      :project))
+  (-> (get @projects project-name)
+      (dissoc ::run-state)))
 
 (defn add-project [project-root]
   (load-project! project-root))

(ns lein-ui.core
    (:require [clojure.java.io :as io]
              [leiningen.core.project :as project]
              [org.httpkit.server :as server]
              [ring.middleware.reload :as reload]
              [compojure.handler :refer [site]]
              [compojure.core :refer [defroutes GET POST DELETE]]
              [compojure.route :as route]))

;;; Projects

(defonce projects (atom {}))

(defrecord Project [project state])
(defn new-project [project-map]
  (->Project project-map (atom {})))

(defn load-project! [root]
  (let [project (->>  (io/file root "project.clj")
                      (.getAbsolutePath)
                      (project/read-raw))]    
       (swap! projects (fn [ps p]
                         (when (ps (:name p))
                           (throw (ex-info (str "Project already loaded")


(defn pprint-str [o]
  (let [w (java.io.StringWriter.)]
    (pprint/pprint o w)
    (.toString w)))


