diff --git a/src/dda/backup/backup.clj b/src/dda/backup/backup.clj index 0664495..14c2f2d 100644 --- a/src/dda/backup/backup.clj +++ b/src/dda/backup/backup.clj @@ -2,14 +2,15 @@ (:require [orchestra.core :refer [defn-spec]] [clojure.spec.alpha :as s] - [dda.backup.core.domain :as core] + [dda.backup.core.domain :as cd] [dda.backup.backup.domain :as domain] + [dda.backup.core :as core] [dda.backup.management :as mgm] [dda.backup.infrastructure :as i])) (s/def ::config - (s/keys :req-un [::core/restic-repository ::core/backup-path] - :opt-un [::core/certificate-file ::core/directory ::core/debug ::core/dry-run])) + (s/keys :req-un [::cd/restic-repository ::cd/backup-path] + :opt-un [::cd/certificate-file ::cd/directory ::cd/debug ::cd/dry-run])) (defn-spec backup! nil? [config ::config diff --git a/src/dda/backup/backup/domain.clj b/src/dda/backup/backup/domain.clj index ef57c5e..16e30dd 100644 --- a/src/dda/backup/backup/domain.clj +++ b/src/dda/backup/backup/domain.clj @@ -2,10 +2,10 @@ (:require [orchestra.core :refer [defn-spec]] [clojure.spec.alpha :as s] - [dda.backup.core.domain :as core])) + [dda.backup.core.domain :as cd])) -(defn-spec backup-files-command ::core/commands - [config ::core/config +(defn-spec backup-files-command ::cd/commands + [config ::cd/config files (s/* string?)] (let [{:keys [certificate-file password-file restic-repository backup-path]} config] - (core/repo-command config (into ["backup"] files)))) + (cd/repo-command config (into ["backup"] files)))) diff --git a/src/dda/backup/core.clj b/src/dda/backup/core.clj index aa8359b..0329127 100644 --- a/src/dda/backup/core.clj +++ b/src/dda/backup/core.clj @@ -1,6 +1,5 @@ (ns dda.backup.core (:require [clojure.spec.alpha :as s] - [orchestra.core :refer [defn-spec]] )) (s/def ::dry-run boolean?) diff --git a/src/dda/backup/management.clj b/src/dda/backup/management.clj index 74609fa..67b993c 100644 --- a/src/dda/backup/management.clj +++ b/src/dda/backup/management.clj @@ -2,14 +2,15 @@ (:require [orchestra.core :refer [defn-spec]] [clojure.spec.alpha :as s] - [dda.backup.core.domain :as core] + [dda.backup.core.domain :as cd] [dda.backup.management.domain :as domain] + [dda.backup.core :as core] [dda.backup.infrastructure :as i])) (s/def ::config - (s/keys :req-un [::core/restic-repository ::core/backup-path] - :opt-un [::core/certificate-file ::core/directory ::core/debug - ::core/dry-run ::core/days-to-keep ::core/months-to-keep])) + (s/keys :req-un [::cd/restic-repository ::cd/backup-path] + :opt-un [::cd/certificate-file ::cd/directory ::cd/debug + ::cd/dry-run ::cd/days-to-keep ::cd/months-to-keep])) (defn-spec initalized? boolean? [config ::config] diff --git a/src/dda/backup/management/domain.clj b/src/dda/backup/management/domain.clj index 0ac8438..cd95f44 100644 --- a/src/dda/backup/management/domain.clj +++ b/src/dda/backup/management/domain.clj @@ -1,29 +1,28 @@ (ns dda.backup.management.domain (:require [orchestra.core :refer [defn-spec]] - [clojure.spec.alpha :as s] - [dda.backup.core.domain :as core])) + [dda.backup.core.domain :as cd])) -(defn-spec check-repo-command ::core/commands - [config ::core/config] - (core/repo-command config ["check"])) +(defn-spec check-repo-command ::cd/commands + [config ::cd/config] + (cd/repo-command config ["check"])) -(defn-spec init-repo-command ::core/commands - [config ::core/config] - (core/repo-command config ["init"])) +(defn-spec init-repo-command ::cd/commands + [config ::cd/config] + (cd/repo-command config ["init"])) -(defn-spec unlock-repo-command ::core/commands - [config ::core/config] - (core/repo-command config ["--cleanup-cache" "unlock"])) +(defn-spec unlock-repo-command ::cd/commands + [config ::cd/config] + (cd/repo-command config ["--cleanup-cache" "unlock"])) -(defn-spec list-snapshot-command ::core/commands - [config ::core/config] - (core/repo-command config ["snapshots"])) +(defn-spec list-snapshot-command ::cd/commands + [config ::cd/config] + (cd/repo-command config ["snapshots"])) -(defn-spec forget-command ::core/commands - [config ::core/config] +(defn-spec forget-command ::cd/commands + [config ::cd/config] (let [{:keys [days-to-keep months-to-keep]} config] - (core/repo-command config ["forget" "--group-by" "''" - "--keep-last" "1" - "--keep-daily" (str days-to-keep) - "--keep-monthly" (str months-to-keep) "--prune"]))) + (cd/repo-command config ["forget" "--group-by" "" + "--keep-last" "1" + "--keep-daily" (str days-to-keep) + "--keep-monthly" (str months-to-keep) "--prune"]))) diff --git a/test/dda/backup/management/domain_test.clj b/test/dda/backup/management/domain_test.clj index 31a326a..f732e28 100644 --- a/test/dda/backup/management/domain_test.clj +++ b/test/dda/backup/management/domain_test.clj @@ -24,7 +24,7 @@ (deftest should-calculate-forget-command (is (= [["restic" "-r" "repo/dir" "-v" "forget" - "--group-by" "''" "--keep-last" "1" + "--group-by" "" "--keep-last" "1" "--keep-daily" "39" "--keep-monthly" "3" "--prune"]] (cut/forget-command {:restic-repository "repo" :backup-path "dir"