;; Debian adjustments for project.clj

(require '[debian.dh-clojure-lein.client :as deb])

(defn dh-clj-adjust-project [project when & _]
  "Drop dev profile plugins and some dependencies, plus :*-paths"
  (case when
    :before-plugins
    (if (some #{:dev} (deb/active-profiles (project)))
      (-> (project)
          (update :plugins deb/del-dep 'lein-codox)
          (update :plugins deb/del-dep 'lein-cljsbuild)
          (update :plugins deb/del-dep 'lein-doo)
          (update :plugins deb/del-dep 'lein-pprint)
          (update :plugins deb/del-dep 'lein-shell)
          (update :plugins deb/del-dep 'jonase/eastwood))
      (project))
    :after-middleware
    (if (some #{:dev} (deb/active-profiles (project)))
      (-> (project)
          (update :dependencies deb/del-dep 'org.clojure/clojurescript)
          (update :dependencies deb/del-dep 'org.clojure/tools.nrepl)
          (update :aliases dissoc "test"))
      (update (project) :aliases dissoc "test"))
    (project)))
