fix ns names

This commit is contained in:
Michael Jerger 2024-08-16 18:10:50 +02:00
parent c6c96f5eb8
commit 95f021586a
6 changed files with 33 additions and 33 deletions

View file

@ -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

View file

@ -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))))

View file

@ -1,6 +1,5 @@
(ns dda.backup.core
(:require [clojure.spec.alpha :as s]
[orchestra.core :refer [defn-spec]]
))
(s/def ::dry-run boolean?)

View file

@ -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]

View file

@ -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"])))

View file

@ -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"