From da2b6cb1a2d07db0118f2625f22c8d1366f1ff00 Mon Sep 17 00:00:00 2001 From: Furkan Bayraktar Date: Sat, 9 May 2020 14:35:30 +0200 Subject: [PATCH] Delete a base and a system (#40) - Added support for deleting a system - Added support for deleting a base - Added a link for slack channel to readme Co-authored-by: Joakim Tengstrand --- project.clj | 2 +- readme.md | 33 +- .../polylith/cmd/create/workspace.clj | 2 +- src/leiningen/polylith/cmd/delete.clj | 34 +- src/leiningen/polylith/cmd/delete/base.clj | 24 + src/leiningen/polylith/cmd/delete/system.clj | 21 + src/leiningen/polylith/cmd/help.clj | 5 +- src/leiningen/polylith/cmd/help/delete.clj | 26 +- src/leiningen/polylith/version.clj | 4 +- test/leiningen/polylith/cmd/delete_test.clj | 497 ++++++++++++++++++ 10 files changed, 626 insertions(+), 22 deletions(-) create mode 100644 src/leiningen/polylith/cmd/delete/base.clj create mode 100644 src/leiningen/polylith/cmd/delete/system.clj diff --git a/project.clj b/project.clj index 0a016ff..3ce589c 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject polylith/lein-polylith "0.2.2" +(defproject polylith/lein-polylith "0.2.3" :description "Polylith - a component based architecture, by Joakim Tengstrand." :url "https://github.com/tengstrand/lein-polylith" :license {:name "Eclipse Public License", diff --git a/readme.md b/readme.md index 366a0cb..ea38901 100644 --- a/readme.md +++ b/readme.md @@ -1494,7 +1494,7 @@ $ lein polylith ``` ``` - Polylith 0.2.2 (2019-02-14) - https://github.com/tengstrand/lein-polylith + Polylith 0.2.3 (2020-05-09) - https://github.com/tengstrand/lein-polylith lein polylith CMD [ARGS] - where CMD [ARGS] are: @@ -1503,7 +1503,7 @@ $ lein polylith changes E P [A] Lists changed components, bases or systems. compile P [A] [S] Compiles changed components, bases and systems. create X N [F] Creates a component, system or workspace. - delete c N Deletes a component. + delete X N [B] Deletes a component, base or system. deps [A] Lists dependencies. diff P [A] [F] Lists all changes since a specific point in time. help [C] Show this help or help for specified command. @@ -1535,6 +1535,9 @@ $ lein polylith lein polylith create w myworkspace com.my.company lein polylith create w myworkspace com.my.company -git lein polylith delete c mycomponent + lein polylith delete b mybase + lein polylith delete s mysystem + lein polylith delete s mysystem mybase lein polylith deps lein polylith deps +c lein polylith deps +f @@ -1748,13 +1751,31 @@ Possible problems could for example be that an unsolvable interface declaration ### delete ``` - Deletes a component and its interface if no other components use it. + Deletes a component and its interface if no other components use it: - lein polylith delete c NAME - NAME = component to delete + lein polylith delete c[omponent] NAME + NAME = Component name + -------------------------------------------------------- + Deletes a base: + + lein polylith delete b[ase] NAME + NAME = Base name. + -------------------------------------------------------- + Deletes a system (and its base if given): + + lein polylith delete s[ystem] NAME [BASE] + NAME = System name. + BASE = Base name. example: lein polylith delete c mycomponent + lein polylith delete component mycomponent + lein polylith delete b mybase + lein polylith create base mybase + lein polylith delete s mysystem + lein polylith delete system mysystem + lein polylith delete s mysystem mybase + lein polylith delete system mysystem mybase ``` ### deps @@ -2012,7 +2033,7 @@ Feel free to contact me:

Twitter: @jtengstrand
Email: joakim[dot]tengstrand[at]gmail[dot]com -You can also get in touch with us in the [Polylith forum](https://polylith.freeflarum.com). +You can also get in touch with us in the [Polylith forum](https://polylith.freeflarum.com) or on [Slack](https://clojurians.slack.com/archives/C013B7MQHJQ). ## License diff --git a/src/leiningen/polylith/cmd/create/workspace.clj b/src/leiningen/polylith/cmd/create/workspace.clj index b93edf5..0dfa5e0 100644 --- a/src/leiningen/polylith/cmd/create/workspace.clj +++ b/src/leiningen/polylith/cmd/create/workspace.clj @@ -14,7 +14,7 @@ "- The [Polylith Tool documentation](https://github.com/tengstrand/lein-polylith)" "- The [RealWorld example app documentation](https://github.com/furkan3ayraktar/clojure-polylith-realworld-example-app)" "" - "You can also get in touch with the Polylith Team via our [forum](https://polylith.freeflarum.com)." + "You can also get in touch with the Polylith Team via our [forum](https://polylith.freeflarum.com) or on [Slack](https://clojurians.slack.com/archives/C013B7MQHJQ)." "" (str "

" name "

") "" diff --git a/src/leiningen/polylith/cmd/delete.clj b/src/leiningen/polylith/cmd/delete.clj index 8dcabb4..56c9e42 100644 --- a/src/leiningen/polylith/cmd/delete.clj +++ b/src/leiningen/polylith/cmd/delete.clj @@ -1,16 +1,36 @@ (ns leiningen.polylith.cmd.delete (:require [leiningen.polylith.cmd.delete.component :as delete-component] + [leiningen.polylith.cmd.delete.base :as delete-base] + [leiningen.polylith.cmd.delete.system :as delete-system] [leiningen.polylith.cmd.shared :as shared])) -(defn validate [ws-path cmd component] - (let [components (shared/all-components ws-path)] +(defn validate [ws-path type entity entity2] + (let [components (shared/all-components ws-path) + bases (shared/all-bases ws-path) + systems (shared/all-systems ws-path)] (cond - (not (shared/component? cmd)) [false "Illegal first argument."] - (not (contains? components component)) [false (str "Component '" component "' does not exist.")] + (not (or (shared/component? type) + (shared/base? type) + (shared/system? type))) [false "Illegal first argument."] + (and (shared/component? type) + (not (contains? components entity))) [false (str "Component '" entity "' does not exist.")] + (and (shared/base? type) + (not (contains? bases entity))) [false (str "Base '" entity "' does not exist.")] + (and (shared/system? type) + (not (contains? systems entity))) [false (str "System '" entity "' does not exist.")] + (and (shared/system? type) + (-> entity2 nil? not) + (not (contains? bases entity2))) [false (str "Base '" entity2 "' does not exist.")] :else [true]))) -(defn execute [ws-path top-dir [cmd component]] - (let [[ok? message] (validate ws-path cmd component)] +(defn execute [ws-path top-dir [type entity entity2]] + (let [[ok? message] (validate ws-path type entity entity2)] (if ok? - (delete-component/delete ws-path top-dir component) + (do + (when (shared/component? type) + (delete-component/delete ws-path top-dir entity)) + (when (shared/base? type) + (delete-base/delete ws-path top-dir entity)) + (when (shared/system? type) + (delete-system/delete ws-path top-dir entity entity2))) (println message)))) diff --git a/src/leiningen/polylith/cmd/delete/base.clj b/src/leiningen/polylith/cmd/delete/base.clj new file mode 100644 index 0000000..d695819 --- /dev/null +++ b/src/leiningen/polylith/cmd/delete/base.clj @@ -0,0 +1,24 @@ +(ns leiningen.polylith.cmd.delete.base + (:require [leiningen.polylith.cmd.shared :as shared] + [leiningen.polylith.file :as file])) + +(defn delete-from-environment [base ns-dir dev-path] + (file/delete-dir (str dev-path "/docs/" base "-readme.md")) + (file/delete-dir (str dev-path "/project-files/bases/" base "-project.clj")) + (file/delete-dir (str dev-path "/resources/" base)) + (file/delete-dir (str dev-path "/src/" ns-dir)) + (file/delete-dir (str dev-path "/test/" ns-dir))) + +(defn delete [ws-path top-dir base] + (let [base-dir (str ws-path "/bases/" base) + base-ns-dir (shared/full-dir-name top-dir base) + dev-dirs (file/directory-names (str ws-path "/environments")) + system-dirs (file/directory-names (str ws-path "/systems")) + env-path (str ws-path "/environments/") + ns-dir (shared/full-dir-name top-dir base)] + (file/delete-dir base-dir) + (doseq [sys-dir system-dirs] + (file/delete-file! (str ws-path "/systems/" sys-dir "/src/" base-ns-dir)) + (file/delete-file! (str ws-path "/systems/" sys-dir "/resources/" base))) + (doseq [dev-dir dev-dirs] + (delete-from-environment base ns-dir (str env-path dev-dir))))) diff --git a/src/leiningen/polylith/cmd/delete/system.clj b/src/leiningen/polylith/cmd/delete/system.clj new file mode 100644 index 0000000..aa3f23e --- /dev/null +++ b/src/leiningen/polylith/cmd/delete/system.clj @@ -0,0 +1,21 @@ +(ns leiningen.polylith.cmd.delete.system + (:require [leiningen.polylith.cmd.shared :as shared] + [leiningen.polylith.file :as file] + [leiningen.polylith.cmd.delete.base :as delete-base])) + +(defn delete-from-environment [system ns-dir dev-path] + (file/delete-dir (str dev-path "/docs/" system "-readme.md")) + (file/delete-dir (str dev-path "/project-files/systems/" system "-project.clj")) + (file/delete-dir (str dev-path "/src/" ns-dir)) + (file/delete-dir (str dev-path "/test/" ns-dir))) + +(defn delete [ws-path top-dir system base] + (let [system-dir (str ws-path "/systems/" system) + dev-dirs (file/directory-names (str ws-path "/environments")) + env-path (str ws-path "/environments/") + ns-dir (shared/full-dir-name top-dir system)] + (when base + (delete-base/delete ws-path top-dir base)) + (file/delete-dir system-dir) + (doseq [dev-dir dev-dirs] + (delete-from-environment system ns-dir (str env-path dev-dir))))) diff --git a/src/leiningen/polylith/cmd/help.clj b/src/leiningen/polylith/cmd/help.clj index b2c1fd7..6d18bd1 100644 --- a/src/leiningen/polylith/cmd/help.clj +++ b/src/leiningen/polylith/cmd/help.clj @@ -28,7 +28,7 @@ (println " changes E P [A] Lists changed components, bases or systems.") (println " compile P [A] [S] Compiles changed components, bases and systems.") (println " create X N [F] Creates a component, system or workspace.") - (println " delete c N Deletes a component.") + (println " delete X N [B] Deletes a component, base or system.") (println " deps [A] Lists dependencies.") (println " diff P [A] [F] Lists all changes since a specific point in time.") ;(println " doc [T] Generates system documentation.") @@ -70,6 +70,9 @@ (println " lein polylith create w myworkspace com.my.company") (println " lein polylith create w myworkspace com.my.company -git") (println " lein polylith delete c mycomponent") + (println " lein polylith delete b mybase") + (println " lein polylith delete s mysystem") + (println " lein polylith delete s mysystem mybase") (println " lein polylith deps") (println " lein polylith deps +c") (println " lein polylith deps +f") diff --git a/src/leiningen/polylith/cmd/help/delete.clj b/src/leiningen/polylith/cmd/help/delete.clj index 74aaeff..c0f8a20 100644 --- a/src/leiningen/polylith/cmd/help/delete.clj +++ b/src/leiningen/polylith/cmd/help/delete.clj @@ -1,10 +1,28 @@ (ns leiningen.polylith.cmd.help.delete) (defn help [] - (println " Deletes a component and its interface if no other components use it.") + (println " Deletes a component and its interface if no other components use it:") (println) - (println " lein polylith delete c NAME") - (println " NAME = component to delete") + (println " lein polylith delete c[omponent] NAME") + (println " NAME = Component name") + (println " --------------------------------------------------------") + (println " Deletes a base:") + (println) + (println " lein polylith delete b[ase] NAME") + (println " NAME = Base name.") + (println " --------------------------------------------------------") + (println " Deletes a system (and its base if given):") + (println) + (println " lein polylith delete s[ystem] NAME [BASE]") + (println " NAME = System name.") + (println " BASE = Base name.") (println) (println " example:") - (println " lein polylith delete c mycomponent")) + (println " lein polylith delete c mycomponent") + (println " lein polylith delete component mycomponent") + (println " lein polylith delete b mybase") + (println " lein polylith create base mybase") + (println " lein polylith delete s mysystem") + (println " lein polylith delete system mysystem") + (println " lein polylith delete s mysystem mybase") + (println " lein polylith delete system mysystem mybase")) diff --git a/src/leiningen/polylith/version.clj b/src/leiningen/polylith/version.clj index ff8b348..56e1890 100644 --- a/src/leiningen/polylith/version.clj +++ b/src/leiningen/polylith/version.clj @@ -1,4 +1,4 @@ (ns leiningen.polylith.version) -(def version "0.2.2") -(def date "2019-02-14") +(def version "0.2.3") +(def date "2020-05-09") diff --git a/test/leiningen/polylith/cmd/delete_test.clj b/test/leiningen/polylith/cmd/delete_test.clj index 43ba94c..76107fa 100644 --- a/test/leiningen/polylith/cmd/delete_test.clj +++ b/test/leiningen/polylith/cmd/delete_test.clj @@ -525,3 +525,500 @@ "systems/system-1/src/my/company/base_1" "systems/system-1/src/my/company/base_1/core.clj"} (set (file/relative-paths ws-dir))))))) + +(deftest delete--delete-base-with-namespace--return-list-without-base + (with-redefs [file/current-path (fn [] @helper/root-dir)] + (let [ws-dir (str @helper/root-dir "/ws1") + project (helper/settings ws-dir "my.company") + _ (helper/execute-polylith nil "create" "w" "ws1" "my.company" "-git") + _ (helper/execute-polylith project "create" "s" "system-1" "base-1") + _ (helper/execute-polylith project "create" "s" "system-2" "base-2") + _ (helper/execute-polylith project "delete" "b" "base-1")] + (is (= #{".gitignore" + ".polylith" + ".polylith/time.edn" + "bases" + "bases/base-2" + "bases/base-2/project.clj" + "bases/base-2/readme.md" + "bases/base-2/resources" + "bases/base-2/resources/.keep" + "bases/base-2/resources/base-2" + "bases/base-2/resources/base-2/.keep" + "bases/base-2/src" + "bases/base-2/src/my" + "bases/base-2/src/my/company" + "bases/base-2/src/my/company/base_2" + "bases/base-2/src/my/company/base_2/core.clj" + "bases/base-2/test" + "bases/base-2/test/my" + "bases/base-2/test/my/company" + "bases/base-2/test/my/company/base_2" + "bases/base-2/test/my/company/base_2/core_test.clj" + "components" + "environments" + "environments/development" + "environments/development/docs" + "environments/development/docs/base-2-readme.md" + "environments/development/docs/system-1-readme.md" + "environments/development/docs/system-2-readme.md" + "environments/development/interfaces" + "environments/development/interfaces/my" + "environments/development/interfaces/my/company" + "environments/development/project-files" + "environments/development/project-files/bases" + "environments/development/project-files/bases/base-2-project.clj" + "environments/development/project-files/components" + "environments/development/project-files/interfaces-project.clj" + "environments/development/project-files/systems" + "environments/development/project-files/systems/system-1-project.clj" + "environments/development/project-files/systems/system-2-project.clj" + "environments/development/project-files/workspace-project.clj" + "environments/development/project.clj" + "environments/development/resources" + "environments/development/resources/.keep" + "environments/development/resources/base-2" + "environments/development/resources/base-2/.keep" + "environments/development/src" + "environments/development/src/my" + "environments/development/src/my/company" + "environments/development/src/my/company/base_2" + "environments/development/src/my/company/base_2/core.clj" + "environments/development/test" + "environments/development/test/my" + "environments/development/test/my/company" + "environments/development/test/my/company/base_2" + "environments/development/test/my/company/base_2/core_test.clj" + "images" + "images/logo.png" + "interfaces" + "interfaces/project.clj" + "interfaces/src" + "interfaces/src/my" + "interfaces/src/my/company" + "project.clj" + "readme.md" + "systems" + "systems/system-1" + "systems/system-1/build.sh" + "systems/system-1/project.clj" + "systems/system-1/readme.md" + "systems/system-1/resources" + "systems/system-1/resources/.keep" + "systems/system-1/src" + "systems/system-1/src/my" + "systems/system-1/src/my/company" + "systems/system-2" + "systems/system-2/build.sh" + "systems/system-2/project.clj" + "systems/system-2/readme.md" + "systems/system-2/resources" + "systems/system-2/resources/.keep" + "systems/system-2/resources/base-2" + "systems/system-2/resources/base-2/.keep" + "systems/system-2/src" + "systems/system-2/src/my" + "systems/system-2/src/my/company" + "systems/system-2/src/my/company/base_2" + "systems/system-2/src/my/company/base_2/core.clj"} + (set (file/relative-paths ws-dir))))))) + +(deftest delete--delete-base-without-namespace--return-list-without-base + (with-redefs [file/current-path (fn [] @helper/root-dir)] + (let [ws-dir (str @helper/root-dir "/ws1") + project (helper/settings ws-dir "") + _ (helper/execute-polylith nil "create" "w" "ws1" "-" "-git") + _ (helper/execute-polylith project "create" "s" "system-1" "base-1") + _ (helper/execute-polylith project "delete" "b" "base-1")] + (is (= #{".gitignore" + ".polylith" + ".polylith/time.edn" + "bases" + "components" + "environments" + "environments/development" + "environments/development/docs" + "environments/development/docs/system-1-readme.md" + "environments/development/interfaces" + "environments/development/project-files" + "environments/development/project-files/bases" + "environments/development/project-files/components" + "environments/development/project-files/interfaces-project.clj" + "environments/development/project-files/systems" + "environments/development/project-files/systems/system-1-project.clj" + "environments/development/project-files/workspace-project.clj" + "environments/development/project.clj" + "environments/development/resources" + "environments/development/resources/.keep" + "environments/development/src" + "environments/development/test" + "images" + "images/logo.png" + "interfaces" + "interfaces/project.clj" + "interfaces/src" + "project.clj" + "readme.md" + "systems" + "systems/system-1" + "systems/system-1/build.sh" + "systems/system-1/project.clj" + "systems/system-1/readme.md" + "systems/system-1/resources" + "systems/system-1/resources/.keep" + "systems/system-1/src"} + (set (file/relative-paths ws-dir))))))) + +(deftest delete--delete-system-with-namespace--return-list-without-system-but-with-base + (with-redefs [file/current-path (fn [] @helper/root-dir)] + (let [ws-dir (str @helper/root-dir "/ws1") + project (helper/settings ws-dir "my.company") + _ (helper/execute-polylith nil "create" "w" "ws1" "my.company" "-git") + _ (helper/execute-polylith project "create" "s" "system-1" "base-1") + _ (helper/execute-polylith project "create" "s" "system-2" "base-2") + _ (helper/execute-polylith project "delete" "s" "system-1")] + (is (= #{".gitignore" + ".polylith" + ".polylith/time.edn" + "bases" + "bases/base-1" + "bases/base-1/project.clj" + "bases/base-1/readme.md" + "bases/base-1/resources" + "bases/base-1/resources/.keep" + "bases/base-1/resources/base-1" + "bases/base-1/src" + "bases/base-1/src/my" + "bases/base-1/src/my/company" + "bases/base-1/src/my/company/base_1" + "bases/base-1/test" + "bases/base-1/test/my" + "bases/base-1/test/my/company" + "bases/base-1/test/my/company/base_1" + "bases/base-1/test/my/company/base_1/core_test.clj" + "bases/base-2" + "bases/base-2/project.clj" + "bases/base-2/readme.md" + "bases/base-2/resources" + "bases/base-2/resources/.keep" + "bases/base-2/resources/base-2" + "bases/base-2/resources/base-2/.keep" + "bases/base-2/src" + "bases/base-2/src/my" + "bases/base-2/src/my/company" + "bases/base-2/src/my/company/base_2" + "bases/base-2/src/my/company/base_2/core.clj" + "bases/base-2/test" + "bases/base-2/test/my" + "bases/base-2/test/my/company" + "bases/base-2/test/my/company/base_2" + "bases/base-2/test/my/company/base_2/core_test.clj" + "components" + "environments" + "environments/development" + "environments/development/docs" + "environments/development/docs/base-1-readme.md" + "environments/development/docs/base-2-readme.md" + "environments/development/docs/system-2-readme.md" + "environments/development/interfaces" + "environments/development/interfaces/my" + "environments/development/interfaces/my/company" + "environments/development/project-files" + "environments/development/project-files/bases" + "environments/development/project-files/bases/base-1-project.clj" + "environments/development/project-files/bases/base-2-project.clj" + "environments/development/project-files/components" + "environments/development/project-files/interfaces-project.clj" + "environments/development/project-files/systems" + "environments/development/project-files/systems/system-2-project.clj" + "environments/development/project-files/workspace-project.clj" + "environments/development/project.clj" + "environments/development/resources" + "environments/development/resources/.keep" + "environments/development/resources/base-1" + "environments/development/resources/base-2" + "environments/development/resources/base-2/.keep" + "environments/development/src" + "environments/development/src/my" + "environments/development/src/my/company" + "environments/development/src/my/company/base_1" + "environments/development/src/my/company/base_2" + "environments/development/src/my/company/base_2/core.clj" + "environments/development/test" + "environments/development/test/my" + "environments/development/test/my/company" + "environments/development/test/my/company/base_1" + "environments/development/test/my/company/base_1/core_test.clj" + "environments/development/test/my/company/base_2" + "environments/development/test/my/company/base_2/core_test.clj" + "images" + "images/logo.png" + "interfaces" + "interfaces/project.clj" + "interfaces/src" + "interfaces/src/my" + "interfaces/src/my/company" + "project.clj" + "readme.md" + "systems" + "systems/system-2" + "systems/system-2/build.sh" + "systems/system-2/project.clj" + "systems/system-2/readme.md" + "systems/system-2/resources" + "systems/system-2/resources/.keep" + "systems/system-2/resources/base-2" + "systems/system-2/resources/base-2/.keep" + "systems/system-2/src" + "systems/system-2/src/my" + "systems/system-2/src/my/company" + "systems/system-2/src/my/company/base_2" + "systems/system-2/src/my/company/base_2/core.clj"} + (set (file/relative-paths ws-dir))))))) + +(deftest delete--delete-system-without-namespace--return-list-without-system-but-with-base + (with-redefs [file/current-path (fn [] @helper/root-dir)] + (let [ws-dir (str @helper/root-dir "/ws1") + project (helper/settings ws-dir "") + _ (helper/execute-polylith nil "create" "w" "ws1" "-" "-git") + _ (helper/execute-polylith project "create" "s" "system-1" "base-1") + _ (helper/execute-polylith project "create" "s" "system-2" "base-2") + _ (helper/execute-polylith project "delete" "s" "system-1")] + (is (= #{".gitignore" + ".polylith" + ".polylith/time.edn" + "bases" + "bases/base-1" + "bases/base-1/project.clj" + "bases/base-1/readme.md" + "bases/base-1/resources" + "bases/base-1/resources/.keep" + "bases/base-1/resources/base-1" + "bases/base-1/src" + "bases/base-1/src/base_1" + "bases/base-1/test" + "bases/base-1/test/base_1" + "bases/base-1/test/base_1/core_test.clj" + "bases/base-2" + "bases/base-2/project.clj" + "bases/base-2/readme.md" + "bases/base-2/resources" + "bases/base-2/resources/.keep" + "bases/base-2/resources/base-2" + "bases/base-2/resources/base-2/.keep" + "bases/base-2/src" + "bases/base-2/src/base_2" + "bases/base-2/src/base_2/core.clj" + "bases/base-2/test" + "bases/base-2/test/base_2" + "bases/base-2/test/base_2/core_test.clj" + "components" + "environments" + "environments/development" + "environments/development/docs" + "environments/development/docs/base-1-readme.md" + "environments/development/docs/base-2-readme.md" + "environments/development/docs/system-2-readme.md" + "environments/development/interfaces" + "environments/development/project-files" + "environments/development/project-files/bases" + "environments/development/project-files/bases/base-1-project.clj" + "environments/development/project-files/bases/base-2-project.clj" + "environments/development/project-files/components" + "environments/development/project-files/interfaces-project.clj" + "environments/development/project-files/systems" + "environments/development/project-files/systems/system-2-project.clj" + "environments/development/project-files/workspace-project.clj" + "environments/development/project.clj" + "environments/development/resources" + "environments/development/resources/.keep" + "environments/development/resources/base-1" + "environments/development/resources/base-2" + "environments/development/resources/base-2/.keep" + "environments/development/src" + "environments/development/src/base_1" + "environments/development/src/base_2" + "environments/development/src/base_2/core.clj" + "environments/development/test" + "environments/development/test/base_1" + "environments/development/test/base_1/core_test.clj" + "environments/development/test/base_2" + "environments/development/test/base_2/core_test.clj" + "images" + "images/logo.png" + "interfaces" + "interfaces/project.clj" + "interfaces/src" + "project.clj" + "readme.md" + "systems" + "systems/system-2" + "systems/system-2/build.sh" + "systems/system-2/project.clj" + "systems/system-2/readme.md" + "systems/system-2/resources" + "systems/system-2/resources/.keep" + "systems/system-2/resources/base-2" + "systems/system-2/resources/base-2/.keep" + "systems/system-2/src" + "systems/system-2/src/base_2" + "systems/system-2/src/base_2/core.clj"} + (set (file/relative-paths ws-dir))))))) + +(deftest delete--delete-system-and-base-with-namespace--return-list-without-system-or-base + (with-redefs [file/current-path (fn [] @helper/root-dir)] + (let [ws-dir (str @helper/root-dir "/ws1") + project (helper/settings ws-dir "my.company") + _ (helper/execute-polylith nil "create" "w" "ws1" "my.company" "-git") + _ (helper/execute-polylith project "create" "s" "system-1" "base-1") + _ (helper/execute-polylith project "create" "s" "system-2" "base-2") + _ (helper/execute-polylith project "delete" "s" "system-1" "base-1")] + (is (= #{".gitignore" + ".polylith" + ".polylith/time.edn" + "bases" + "bases/base-2" + "bases/base-2/project.clj" + "bases/base-2/readme.md" + "bases/base-2/resources" + "bases/base-2/resources/.keep" + "bases/base-2/resources/base-2" + "bases/base-2/resources/base-2/.keep" + "bases/base-2/src" + "bases/base-2/src/my" + "bases/base-2/src/my/company" + "bases/base-2/src/my/company/base_2" + "bases/base-2/src/my/company/base_2/core.clj" + "bases/base-2/test" + "bases/base-2/test/my" + "bases/base-2/test/my/company" + "bases/base-2/test/my/company/base_2" + "bases/base-2/test/my/company/base_2/core_test.clj" + "components" + "environments" + "environments/development" + "environments/development/docs" + "environments/development/docs/base-2-readme.md" + "environments/development/docs/system-2-readme.md" + "environments/development/interfaces" + "environments/development/interfaces/my" + "environments/development/interfaces/my/company" + "environments/development/project-files" + "environments/development/project-files/bases" + "environments/development/project-files/bases/base-2-project.clj" + "environments/development/project-files/components" + "environments/development/project-files/interfaces-project.clj" + "environments/development/project-files/systems" + "environments/development/project-files/systems/system-2-project.clj" + "environments/development/project-files/workspace-project.clj" + "environments/development/project.clj" + "environments/development/resources" + "environments/development/resources/.keep" + "environments/development/resources/base-2" + "environments/development/resources/base-2/.keep" + "environments/development/src" + "environments/development/src/my" + "environments/development/src/my/company" + "environments/development/src/my/company/base_2" + "environments/development/src/my/company/base_2/core.clj" + "environments/development/test" + "environments/development/test/my" + "environments/development/test/my/company" + "environments/development/test/my/company/base_2" + "environments/development/test/my/company/base_2/core_test.clj" + "images" + "images/logo.png" + "interfaces" + "interfaces/project.clj" + "interfaces/src" + "interfaces/src/my" + "interfaces/src/my/company" + "project.clj" + "readme.md" + "systems" + "systems/system-2" + "systems/system-2/build.sh" + "systems/system-2/project.clj" + "systems/system-2/readme.md" + "systems/system-2/resources" + "systems/system-2/resources/.keep" + "systems/system-2/resources/base-2" + "systems/system-2/resources/base-2/.keep" + "systems/system-2/src" + "systems/system-2/src/my" + "systems/system-2/src/my/company" + "systems/system-2/src/my/company/base_2" + "systems/system-2/src/my/company/base_2/core.clj"} + (set (file/relative-paths ws-dir))))))) + +(deftest delete--delete-system-and-base-without-namespace--return-list-without-system-or-base + (with-redefs [file/current-path (fn [] @helper/root-dir)] + (let [ws-dir (str @helper/root-dir "/ws1") + project (helper/settings ws-dir "") + _ (helper/execute-polylith nil "create" "w" "ws1" "-" "-git") + _ (helper/execute-polylith project "create" "s" "system-1" "base-1") + _ (helper/execute-polylith project "create" "s" "system-2" "base-2") + _ (helper/execute-polylith project "delete" "s" "system-1" "base-1")] + (is (= #{".gitignore" + ".polylith" + ".polylith/time.edn" + "bases" + "bases/base-2" + "bases/base-2/project.clj" + "bases/base-2/readme.md" + "bases/base-2/resources" + "bases/base-2/resources/.keep" + "bases/base-2/resources/base-2" + "bases/base-2/resources/base-2/.keep" + "bases/base-2/src" + "bases/base-2/src/base_2" + "bases/base-2/src/base_2/core.clj" + "bases/base-2/test" + "bases/base-2/test/base_2" + "bases/base-2/test/base_2/core_test.clj" + "components" + "environments" + "environments/development" + "environments/development/docs" + "environments/development/docs/base-2-readme.md" + "environments/development/docs/system-2-readme.md" + "environments/development/interfaces" + "environments/development/project-files" + "environments/development/project-files/bases" + "environments/development/project-files/bases/base-2-project.clj" + "environments/development/project-files/components" + "environments/development/project-files/interfaces-project.clj" + "environments/development/project-files/systems" + "environments/development/project-files/systems/system-2-project.clj" + "environments/development/project-files/workspace-project.clj" + "environments/development/project.clj" + "environments/development/resources" + "environments/development/resources/.keep" + "environments/development/resources/base-2" + "environments/development/resources/base-2/.keep" + "environments/development/src" + "environments/development/src/base_2" + "environments/development/src/base_2/core.clj" + "environments/development/test" + "environments/development/test/base_2" + "environments/development/test/base_2/core_test.clj" + "images" + "images/logo.png" + "interfaces" + "interfaces/project.clj" + "interfaces/src" + "project.clj" + "readme.md" + "systems" + "systems/system-2" + "systems/system-2/build.sh" + "systems/system-2/project.clj" + "systems/system-2/readme.md" + "systems/system-2/resources" + "systems/system-2/resources/.keep" + "systems/system-2/resources/base-2" + "systems/system-2/resources/base-2/.keep" + "systems/system-2/src" + "systems/system-2/src/base_2" + "systems/system-2/src/base_2/core.clj"} + (set (file/relative-paths ws-dir)))))))