refactor for aggregate boundaries

This commit is contained in:
Michael Jerger 2024-07-27 16:31:54 +02:00
parent 0cbd256547
commit ae5ccc60f1
5 changed files with 27 additions and 11 deletions

View file

@ -1,5 +1,5 @@
{:project {:name org.domaindrivenarchitecture/build {:project {:name org.domaindrivenarchitecture/build
:version "0.1.0"} :version "0.1.1-SNAPSHOT"}
:paths :paths
["src" "resources"] ["src" "resources"]

View file

@ -1,7 +1,9 @@
(ns dda.build.devops (ns dda.build.devops
(:require (:require
[orchestra.core :refer [defn-spec]]
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[dda.build.devops.domain :as domain])) [dda.build.devops.domain :as domain]
[dda.build.infrastructure :as i]))
(s/def ::name ::domain/name) (s/def ::name ::domain/name)
(s/def ::module ::domain/module) (s/def ::module ::domain/module)
@ -11,9 +13,21 @@
(s/def ::devops (s/def ::devops
(s/keys :req-un [::name] (s/keys :req-un [::name]
:opt-un [::module ::stage ::project-root-path ::build-dir-name])) :opt-un [::module ::stage ::project-root-path ::build-dir-name ::debug ::dry-run]))
(def default {:name "dda-backup" (def default {:name "dda-backup"
:project-root-path "." :project-root-path "."
:build-dir-name "target" :build-dir-name "target"
:stage "dev"}) :stage "dev"
:debug false
:dry-run false})
(defn-spec clean-build-dir nil?
[devops ::devops]
(let [final (merge default devops)]
(i/execute (domain/clean-build-dir-command final) final)))
(defn-spec create-build-dir nil?
[devops ::devops]
(let [final (merge default devops)]
(i/execute (domain/create-build-dir-command final) final)))

View file

@ -2,7 +2,6 @@
(:require [orchestra.core :refer [defn-spec]] (:require [orchestra.core :refer [defn-spec]]
[babashka.tasks :as t] [babashka.tasks :as t]
[dda.build.devops :as d] [dda.build.devops :as d]
[dda.build.devops.domain :as dd]
[dda.build.image.domain :as domain])) [dda.build.image.domain :as domain]))
(def default (def default
@ -11,7 +10,7 @@
(defn-spec dbuild nil? (defn-spec dbuild nil?
[devops ::d/devops] [devops ::d/devops]
(let [final (merge default devops)] (let [final (merge default devops)]
(apply t/shell (dd/clean-build-dir-command final)) (d/create-build-dir final)
(apply t/shell (dd/create-build-dir-command final)) (d/create-build-dir final)
(apply t/shell (domain/copy-image-command final)) (apply t/shell (domain/copy-image-command final))
(apply t/shell (domain/dbuild-command final)))) (apply t/shell (domain/dbuild-command final))))

View file

@ -1,6 +1,5 @@
(ns dda.build.image.domain (ns dda.build.image.domain
(:require [clojure.spec.alpha :as s] (:require [orchestra.core :refer [defn-spec]]
[orchestra.core :refer [defn-spec]]
[dda.build.devops.domain :as d])) [dda.build.devops.domain :as d]))
(defn-spec copy-image-command seq? (defn-spec copy-image-command seq?

View file

@ -14,7 +14,9 @@
:project-root-path "../.." :project-root-path "../.."
:build-dir-name "target" :build-dir-name "target"
:version "4.11.8-dev" :version "4.11.8-dev"
:stage "dev"})))) :stage "dev"
:debug false
:dry-run false}))))
(deftest should-calculate-dbuild-command (deftest should-calculate-dbuild-command
(is (= ["docker" (is (= ["docker"
@ -28,5 +30,7 @@
:project-root-path "../.." :project-root-path "../.."
:build-dir-name "target" :build-dir-name "target"
:version "4.11.8-dev" :version "4.11.8-dev"
:stage "dev"})))) :stage "dev"
:debug false
:dry-run false}))))