       (if (fs/directory? f)
         (fs/copy-dir f staging-dir)
         (fs/copy+ f (format "%s/%s" staging-dir (fs/base-name f)))))))
+
+(defn get-project-file
+  [project]
+  (let [project-file-by-dir (.toString (fs/file project "project.clj"))
+        project-file-by-name (.toString (fs/file "configs/" project
+                                                 (str project ".clj")))]
+    (if (fs/file? project-file-by-dir)
+      project-file-by-dir
+      project-file-by-name)))
 
 (defn cp-project-file
   [project-file template-vars]

(defn -main
  [& args]
  (if (>= (count args) 2)
    (let [[action project-dir & template-vars] args]
      (if-not (every? (partial re-find #"=") template-vars)
        (exit 1 "Arguments after the project name are expected to be variable bindings of the form <variable>=<value>")
        (try
          (ezbake-init action project-dir template-vars)
          (finally
            ;; this is required in order to make the threads started by sh/sh terminate,
            ;; and thus allow the jvm to exit

  (exit 1 (str/join \newline ["Unrecognized option:" action "" (usage)])))

(defn ezbake-init
  [action project template-vars]
  (clean)
  (fs/mkdirs staging-dir)
  (let [project-file (get-project-file project)
        template-vars (->> template-vars
                        (map #(str/split % #"="))
                        (into {}))]
