Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resources folder has wrong name #21

Merged
merged 1 commit into from
Nov 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/leiningen/polylith/cmd/create/component.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
components (set/intersection entities (shared/all-components ws-path))]
(first (filter #(= interface (shared/interface-of ws-path top-dir %)) components))))

(defn create-dev-links! [ws-path dev-dir component interface-dir component-dir]
(defn create-dev-links! [ws-path dev-dir component interface interface-dir component-dir]
(let [root (str ws-path "/environments/" dev-dir)
relative-parent-path (shared/relative-parent-path component-dir)
path (str "../../../components/" component)
Expand All @@ -30,8 +30,8 @@
(str relative-component-path "/test/" interface-dir))
(file/create-symlink (str root "/src/" interface-dir)
(str relative-component-path "/src/" interface-dir))
(file/create-symlink (str root "/resources/" component)
(str path "/resources/" component))))
(file/create-symlink (str root "/resources/" interface)
(str path "/resources/" interface))))

(defn create [ws-path top-dir top-ns clojure-version component interface-name]
(let [interface (if (str/blank? interface-name) component interface-name)
Expand All @@ -57,11 +57,11 @@
"add documentation here..."]
test-content [(str "(ns " interface-ns-name ".core-test")
(str " (:require [clojure.test :refer :all]")
(str " [" interface-ns-name ".interface :as " component "]))")
(str " [" interface-ns-name ".interface :as " interface "]))")
""
";; add your tests here..."
"(deftest test-add-two"
(str " (is (= 42 (" component "/add-two 40))))")]
(str " (is (= 42 (" interface "/add-two 40))))")]
project-content [(str "(defproject " project-ns " \"0.1\"")
(str " :description \"A " component " component.\"")
(str " :dependencies [[" interfaces-dependencies " \"1.0\"]")
Expand All @@ -72,8 +72,8 @@
(file/create-dir comp-root-dir)
(file/create-dir (str comp-root-dir "/resources"))
(file/create-file (str comp-root-dir "/resources/.keep") [""])
(file/create-dir (str comp-root-dir "/resources/" component))
(file/create-file (str comp-root-dir "/resources/" component "/.keep") [""])
(file/create-dir (str comp-root-dir "/resources/" interface))
(file/create-file (str comp-root-dir "/resources/" interface "/.keep") [""])
(shared/create-src-dirs! ws-path (str "components/" component "/src") [interface-dir])
(shared/create-src-dirs! ws-path (str "components/" component "/test") [interface-dir])
(file/create-file (str comp-root-dir "/project.clj") project-content)
Expand All @@ -87,7 +87,7 @@

(doseq [dev-dir dev-dirs]
(if (create-dev-links? ws-path top-dir dev-dir interface)
(create-dev-links! ws-path dev-dir component interface-dir component-dir)
(create-dev-links! ws-path dev-dir component interface interface-dir component-dir)
(println (str "FYI: the component " component " was created but not added to " dev-dir
" because it's interface " interface " was already "
"used by " (used-by-component ws-path top-dir dev-dir interface) "."))))))
26 changes: 12 additions & 14 deletions test/leiningen/polylith/cmd/add_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
"components/comp1/readme.md"
"components/comp1/resources"
"components/comp1/resources/.keep"
"components/comp1/resources/comp1"
"components/comp1/resources/comp1/.keep"
"components/comp1/resources/ifc1"
"components/comp1/resources/ifc1/.keep"
"components/comp1/src"
"components/comp1/src/my"
"components/comp1/src/my/company"
Expand Down Expand Up @@ -97,8 +97,8 @@
"environments/development/resources/.keep"
"environments/development/resources/base1"
"environments/development/resources/base1/.keep"
"environments/development/resources/comp1"
"environments/development/resources/comp1/.keep"
"environments/development/resources/ifc1"
"environments/development/resources/ifc1/.keep"
"environments/development/src"
"environments/development/src/my"
"environments/development/src/my/company"
Expand All @@ -114,15 +114,15 @@
"environments/development/test/my/company/base1/core_test.clj"
"environments/development/test/my/company/ifc1"
"environments/development/test/my/company/ifc1/core_test.clj"
"images"
"images/logo.png"
"interfaces"
"interfaces/project.clj"
"interfaces/src"
"interfaces/src/my"
"interfaces/src/my/company"
"interfaces/src/my/company/ifc1"
"interfaces/src/my/company/ifc1/interface.clj"
"images"
"images/logo.png"
"project.clj"
"readme.md"
"systems"
Expand All @@ -135,7 +135,6 @@
"systems/sys1/resources/base1"
"systems/sys1/resources/base1/.keep"
"systems/sys1/resources/comp1"
"systems/sys1/resources/comp1/.keep"
"systems/sys1/src"
"systems/sys1/src/my"
"systems/sys1/src/my/company"
Expand Down Expand Up @@ -205,8 +204,8 @@
"components/comp-1/readme.md"
"components/comp-1/resources"
"components/comp-1/resources/.keep"
"components/comp-1/resources/comp-1"
"components/comp-1/resources/comp-1/.keep"
"components/comp-1/resources/ifc-1"
"components/comp-1/resources/ifc-1/.keep"
"components/comp-1/src"
"components/comp-1/src/my"
"components/comp-1/src/my/company"
Expand All @@ -223,8 +222,8 @@
"components/comp-2/readme.md"
"components/comp-2/resources"
"components/comp-2/resources/.keep"
"components/comp-2/resources/comp-2"
"components/comp-2/resources/comp-2/.keep"
"components/comp-2/resources/ifc-1"
"components/comp-2/resources/ifc-1/.keep"
"components/comp-2/src"
"components/comp-2/src/my"
"components/comp-2/src/my/company"
Expand Down Expand Up @@ -261,8 +260,8 @@
"environments/development/resources/.keep"
"environments/development/resources/base-1"
"environments/development/resources/base-1/.keep"
"environments/development/resources/comp-1"
"environments/development/resources/comp-1/.keep"
"environments/development/resources/ifc-1"
"environments/development/resources/ifc-1/.keep"
"environments/development/src"
"environments/development/src/my"
"environments/development/src/my/company"
Expand Down Expand Up @@ -299,7 +298,6 @@
"systems/sys-1/resources/base-1"
"systems/sys-1/resources/base-1/.keep"
"systems/sys-1/resources/comp-1"
"systems/sys-1/resources/comp-1/.keep"
"systems/sys-1/src"
"systems/sys-1/src/my"
"systems/sys-1/src/my/company"
Expand Down
38 changes: 19 additions & 19 deletions test/leiningen/polylith/cmd/create_component_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
['defn 'add-two ['x]
['+ '2 'x]]])

(defn ->add-two [component]
(symbol (name component) "add-two"))
(defn ->add-two [interface]
(symbol (name interface) "add-two"))

(defn component-core-test-content [component ns-name require-ns]
(defn component-core-test-content [interface ns-name require-ns]
[['ns ns-name
[:require ['clojure.test :refer :all]
[require-ns :as component]]]
[require-ns :as interface]]]
['deftest 'test-add-two
['is ['= 42 [(->add-two component) 40]]]]])
['is ['= 42 [(->add-two interface) 40]]]]])

(defn src-interface-content [ns-name require-ns]
[['ns ns-name
Expand Down Expand Up @@ -320,8 +320,8 @@
"components/log-4j/project.clj"
"components/log-4j/resources"
"components/log-4j/resources/.keep"
"components/log-4j/resources/log-4j"
"components/log-4j/resources/log-4j/.keep"
"components/log-4j/resources/logg-ing"
"components/log-4j/resources/logg-ing/.keep"
"components/log-4j/src"
"components/log-4j/src/my"
"components/log-4j/src/my/company"
Expand Down Expand Up @@ -352,8 +352,8 @@
"environments/development/project.clj"
"environments/development/resources"
"environments/development/resources/.keep"
"environments/development/resources/log-4j"
"environments/development/resources/log-4j/.keep"
"environments/development/resources/logg-ing"
"environments/development/resources/logg-ing/.keep"
"environments/development/src"
"environments/development/src/my"
"environments/development/src/my/company"
Expand Down Expand Up @@ -390,7 +390,7 @@
(is (= (src-core-content 'my.company.logg-ing.core)
(helper/content ws-dir "components/log-4j/src/my/company/logg_ing/core.clj")))

(is (= (component-core-test-content 'log-4j 'my.company.logg-ing.core-test 'my.company.logg-ing.interface)
(is (= (component-core-test-content 'logg-ing 'my.company.logg-ing.core-test 'my.company.logg-ing.interface)
(helper/content ws-dir "components/log-4j/test/my/company/logg_ing/core_test.clj")))

(is (= (src-interface-content 'my.company.logg-ing.interface 'my.company.logg-ing.core)
Expand All @@ -411,7 +411,7 @@
(is (= (helper/component-project-content "log-4j" 'my.company/log-4j 'my.company/interfaces)
(helper/content ws-dir "environments/development/project-files/components/log-4j-project.clj")))

(is (= (component-core-test-content 'log-4j 'my.company.logg-ing.core-test 'my.company.logg-ing.interface)
(is (= (component-core-test-content 'logg-ing 'my.company.logg-ing.core-test 'my.company.logg-ing.interface)
(helper/content ws-dir "environments/development/test/my/company/logg_ing/core_test.clj")))

(is (= (development-project-content 'my.company/development)
Expand Down Expand Up @@ -443,8 +443,8 @@
"components/commonslogging/project.clj"
"components/commonslogging/resources"
"components/commonslogging/resources/.keep"
"components/commonslogging/resources/commonslogging"
"components/commonslogging/resources/commonslogging/.keep"
"components/commonslogging/resources/logging"
"components/commonslogging/resources/logging/.keep"
"components/commonslogging/src"
"components/commonslogging/src/my"
"components/commonslogging/src/my/company"
Expand All @@ -461,8 +461,8 @@
"components/log4j/project.clj"
"components/log4j/resources"
"components/log4j/resources/.keep"
"components/log4j/resources/log4j"
"components/log4j/resources/log4j/.keep"
"components/log4j/resources/logging"
"components/log4j/resources/logging/.keep"
"components/log4j/src"
"components/log4j/src/my"
"components/log4j/src/my/company"
Expand Down Expand Up @@ -493,8 +493,8 @@
"environments/development/project.clj"
"environments/development/resources"
"environments/development/resources/.keep"
"environments/development/resources/log4j"
"environments/development/resources/log4j/.keep"
"environments/development/resources/logging"
"environments/development/resources/logging/.keep"
"environments/development/src"
"environments/development/src/my"
"environments/development/src/my/company"
Expand Down Expand Up @@ -531,7 +531,7 @@
(is (= (src-core-content 'my.company.logging.core)
(helper/content ws-dir "components/log4j/src/my/company/logging/core.clj")))

(is (= (component-core-test-content 'log4j 'my.company.logging.core-test 'my.company.logging.interface)
(is (= (component-core-test-content 'logging 'my.company.logging.core-test 'my.company.logging.interface)
(helper/content ws-dir "components/log4j/test/my/company/logging/core_test.clj")))

(is (= (src-interface-content 'my.company.logging.interface 'my.company.logging.core)
Expand All @@ -552,7 +552,7 @@
(is (= (helper/component-project-content "log4j" 'my.company/log4j 'my.company/interfaces)
(helper/content ws-dir "environments/development/project-files/components/log4j-project.clj")))

(is (= (component-core-test-content 'log4j 'my.company.logging.core-test 'my.company.logging.interface)
(is (= (component-core-test-content 'logging 'my.company.logging.core-test 'my.company.logging.interface)
(helper/content ws-dir "environments/development/test/my/company/logging/core_test.clj")))

(is (= (development-project-content 'my.company/development)
Expand Down
21 changes: 11 additions & 10 deletions test/leiningen/polylith/cmd/delete_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
"environments/development/resources/comp-1/.keep"
"environments/development/resources/comp-3"
"environments/development/resources/comp-3/.keep"
"environments/development/resources/interface-2"
"environments/development/resources/system-1"
"environments/development/resources/system-1/.keep"
"environments/development/src"
Expand Down Expand Up @@ -260,8 +261,8 @@
"components/comp-3/readme.md"
"components/comp-3/resources"
"components/comp-3/resources/.keep"
"components/comp-3/resources/comp-3"
"components/comp-3/resources/comp-3/.keep"
"components/comp-3/resources/interface-2"
"components/comp-3/resources/interface-2/.keep"
"components/comp-3/src"
"components/comp-3/src/my"
"components/comp-3/src/my/company"
Expand Down Expand Up @@ -299,6 +300,7 @@
"environments/development/resources/.keep"
"environments/development/resources/comp-1"
"environments/development/resources/comp-1/.keep"
"environments/development/resources/interface-2"
"environments/development/resources/system-1"
"environments/development/resources/system-1/.keep"
"environments/development/src"
Expand Down Expand Up @@ -411,8 +413,8 @@
"components/component-3/readme.md"
"components/component-3/resources"
"components/component-3/resources/.keep"
"components/component-3/resources/component-3"
"components/component-3/resources/component-3/.keep"
"components/component-3/resources/interface-1"
"components/component-3/resources/interface-1/.keep"
"components/component-3/src"
"components/component-3/src/my"
"components/component-3/src/my/company"
Expand All @@ -429,8 +431,8 @@
"components/component-5/readme.md"
"components/component-5/resources"
"components/component-5/resources/.keep"
"components/component-5/resources/component-5"
"components/component-5/resources/component-5/.keep"
"components/component-5/resources/component-4"
"components/component-5/resources/component-4/.keep"
"components/component-5/src"
"components/component-5/src/my"
"components/component-5/src/my/company"
Expand Down Expand Up @@ -471,10 +473,9 @@
"environments/development/resources/.keep"
"environments/development/resources/base-1"
"environments/development/resources/base-1/.keep"
"environments/development/resources/component-3"
"environments/development/resources/component-3/.keep"
"environments/development/resources/component-5"
"environments/development/resources/component-5/.keep"
"environments/development/resources/component-4"
"environments/development/resources/component-4/.keep"
"environments/development/resources/interface-1"
"environments/development/src"
"environments/development/src/my"
"environments/development/src/my/company"
Expand Down
16 changes: 8 additions & 8 deletions test/leiningen/polylith/cmd/remove_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
"components/comp-2/readme.md"
"components/comp-2/resources"
"components/comp-2/resources/.keep"
"components/comp-2/resources/comp-2"
"components/comp-2/resources/comp-2/.keep"
"components/comp-2/resources/ifc-2"
"components/comp-2/resources/ifc-2/.keep"
"components/comp-2/src"
"components/comp-2/src/my"
"components/comp-2/src/my/company"
Expand Down Expand Up @@ -106,8 +106,8 @@
"environments/development/resources/base-1/.keep"
"environments/development/resources/comp-1"
"environments/development/resources/comp-1/.keep"
"environments/development/resources/comp-2"
"environments/development/resources/comp-2/.keep"
"environments/development/resources/ifc-2"
"environments/development/resources/ifc-2/.keep"
"environments/development/src"
"environments/development/src/my"
"environments/development/src/my/company"
Expand Down Expand Up @@ -211,8 +211,8 @@
"components/comp2/readme.md"
"components/comp2/resources"
"components/comp2/resources/.keep"
"components/comp2/resources/comp2"
"components/comp2/resources/comp2/.keep"
"components/comp2/resources/ifc2"
"components/comp2/resources/ifc2/.keep"
"components/comp2/src"
"components/comp2/src/ifc2"
"components/comp2/src/ifc2/core.clj"
Expand Down Expand Up @@ -249,8 +249,8 @@
"environments/development/resources/base1/.keep"
"environments/development/resources/comp1"
"environments/development/resources/comp1/.keep"
"environments/development/resources/comp2"
"environments/development/resources/comp2/.keep"
"environments/development/resources/ifc2"
"environments/development/resources/ifc2/.keep"
"environments/development/src"
"environments/development/src/base1"
"environments/development/src/base1/core.clj"
Expand Down