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 (:require
[orchestra.core :refer [defn-spec]] [orchestra.core :refer [defn-spec]]
[clojure.spec.alpha :as s] [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.backup.domain :as domain]
[dda.backup.core :as core]
[dda.backup.management :as mgm] [dda.backup.management :as mgm]
[dda.backup.infrastructure :as i])) [dda.backup.infrastructure :as i]))
(s/def ::config (s/def ::config
(s/keys :req-un [::core/restic-repository ::core/backup-path] (s/keys :req-un [::cd/restic-repository ::cd/backup-path]
:opt-un [::core/certificate-file ::core/directory ::core/debug ::core/dry-run])) :opt-un [::cd/certificate-file ::cd/directory ::cd/debug ::cd/dry-run]))
(defn-spec backup! nil? (defn-spec backup! nil?
[config ::config [config ::config

View file

@ -2,10 +2,10 @@
(:require (:require
[orchestra.core :refer [defn-spec]] [orchestra.core :refer [defn-spec]]
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[dda.backup.core.domain :as core])) [dda.backup.core.domain :as cd]))
(defn-spec backup-files-command ::core/commands (defn-spec backup-files-command ::cd/commands
[config ::core/config [config ::cd/config
files (s/* string?)] files (s/* string?)]
(let [{:keys [certificate-file password-file restic-repository backup-path]} config] (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 (ns dda.backup.core
(:require [clojure.spec.alpha :as s] (:require [clojure.spec.alpha :as s]
[orchestra.core :refer [defn-spec]]
)) ))
(s/def ::dry-run boolean?) (s/def ::dry-run boolean?)

View file

@ -2,14 +2,15 @@
(:require (:require
[orchestra.core :refer [defn-spec]] [orchestra.core :refer [defn-spec]]
[clojure.spec.alpha :as s] [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.management.domain :as domain]
[dda.backup.core :as core]
[dda.backup.infrastructure :as i])) [dda.backup.infrastructure :as i]))
(s/def ::config (s/def ::config
(s/keys :req-un [::core/restic-repository ::core/backup-path] (s/keys :req-un [::cd/restic-repository ::cd/backup-path]
:opt-un [::core/certificate-file ::core/directory ::core/debug :opt-un [::cd/certificate-file ::cd/directory ::cd/debug
::core/dry-run ::core/days-to-keep ::core/months-to-keep])) ::cd/dry-run ::cd/days-to-keep ::cd/months-to-keep]))
(defn-spec initalized? boolean? (defn-spec initalized? boolean?
[config ::config] [config ::config]

View file

@ -1,29 +1,28 @@
(ns dda.backup.management.domain (ns dda.backup.management.domain
(:require (:require
[orchestra.core :refer [defn-spec]] [orchestra.core :refer [defn-spec]]
[clojure.spec.alpha :as s] [dda.backup.core.domain :as cd]))
[dda.backup.core.domain :as core]))
(defn-spec check-repo-command ::core/commands (defn-spec check-repo-command ::cd/commands
[config ::core/config] [config ::cd/config]
(core/repo-command config ["check"])) (cd/repo-command config ["check"]))
(defn-spec init-repo-command ::core/commands (defn-spec init-repo-command ::cd/commands
[config ::core/config] [config ::cd/config]
(core/repo-command config ["init"])) (cd/repo-command config ["init"]))
(defn-spec unlock-repo-command ::core/commands (defn-spec unlock-repo-command ::cd/commands
[config ::core/config] [config ::cd/config]
(core/repo-command config ["--cleanup-cache" "unlock"])) (cd/repo-command config ["--cleanup-cache" "unlock"]))
(defn-spec list-snapshot-command ::core/commands (defn-spec list-snapshot-command ::cd/commands
[config ::core/config] [config ::cd/config]
(core/repo-command config ["snapshots"])) (cd/repo-command config ["snapshots"]))
(defn-spec forget-command ::core/commands (defn-spec forget-command ::cd/commands
[config ::core/config] [config ::cd/config]
(let [{:keys [days-to-keep months-to-keep]} config] (let [{:keys [days-to-keep months-to-keep]} config]
(core/repo-command config ["forget" "--group-by" "''" (cd/repo-command config ["forget" "--group-by" ""
"--keep-last" "1" "--keep-last" "1"
"--keep-daily" (str days-to-keep) "--keep-daily" (str days-to-keep)
"--keep-monthly" (str months-to-keep) "--prune"]))) "--keep-monthly" (str months-to-keep) "--prune"])))

View file

@ -24,7 +24,7 @@
(deftest should-calculate-forget-command (deftest should-calculate-forget-command
(is (= [["restic" "-r" "repo/dir" "-v" "forget" (is (= [["restic" "-r" "repo/dir" "-v" "forget"
"--group-by" "''" "--keep-last" "1" "--group-by" "" "--keep-last" "1"
"--keep-daily" "39" "--keep-monthly" "3" "--prune"]] "--keep-daily" "39" "--keep-monthly" "3" "--prune"]]
(cut/forget-command {:restic-repository "repo" (cut/forget-command {:restic-repository "repo"
:backup-path "dir" :backup-path "dir"