     :jar-exclusions
     :checkout-deps-shares
 
-    ;; include our data state in here
+    ;; also remove our data
     ;; TODO move our state out of the project map?
     ::run-state
-    })
-
-(defn get-project [project-name]
-  (apply dissoc (get @projects project-name)
+    ::raw})
+
+(defn get-readable-project [project-name]
+  (apply dissoc (get-project* project-name)
+         non-data-keys))
+
+(defn get-readable-raw-project [project-name]
+  (apply dissoc (::raw (get-project* project-name))
          non-data-keys))
 
 (defn project-summary [project]


(defonce projects (atom {}))

(defn new-project [project-map]
  (assoc project-map ::run-state (atom {})))

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


(defn unload-project! [name]
  (swap! projects dissoc name))

(defn reload-project! [name]
  (let [root (-> @projects (get name) :root)]
    (unload-project! name)
    (load-project! root)))

(defn get-project* [name]
  (if-let [project (@projects name)]
    project
    (throw (ex-info "Project doesn't exist" {:name name}))))

;; adapated from leiningen.core.eval
(defn- overridden-env

       (let [project (get-project* project-name)
             run-state @(project ::run-state)]
         {:body (pprint-str
                 (merge (project-summary project)
                        ;; TODO just include these in the summary?
                        {:map-url (str (url-for-project project-name)
                                                "/map")
                         :raw-map-url (str (url-for-project project-name)
                                           "/raw-map")
                         :repl {:state (if (run-state :repl)
                                         :started
                                         :stopped)
                                :url (str (url-for-project project-name)
                                          "/repl")}}))
          :status 200}))
  (GET "/api/projects/:project-name/map" [project-name]
       {:body (pprint-str (get-readable-project project-name))
        :status 200})
  (GET "/api/projects/:project-name/raw-map" [project-name]
       {:body (pprint-str (get-readable-raw-project project-name))
        :status 200})
  (POST "/api/projects" [root]
        (let [name (load-project! root)]
          {:status 201
