-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Handle system and "Polylith exceptions" in a cleaner way. * Updated the help for 'sync'. * Updated CircleCI config. (#8) * Accept non vector import statements (#11) * Use interface name as component namespace (#12) * Updated version to 0.2.0.
- Loading branch information
1 parent
a1de6e9
commit 52329e3
Showing
33 changed files
with
732 additions
and
753 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,17 @@ | ||
(ns leiningen.polylith | ||
(:require [clojure.string :as str] | ||
[leiningen.polylith.cmd.add :as add] | ||
[leiningen.polylith.cmd.build :as build] | ||
[leiningen.polylith.cmd.changes :as changes] | ||
[leiningen.polylith.cmd.compile :as compile] | ||
[leiningen.polylith.cmd.create :as create] | ||
[leiningen.polylith.cmd.delete :as delete] | ||
[leiningen.polylith.cmd.deps :as deps] | ||
[leiningen.polylith.cmd.diff :as diff] | ||
;[leiningen.polylith.cmd.doc :as doc]] | ||
(:require [clojure.stacktrace :as stacktrace] | ||
[leiningen.polylith.cmd.help :as help] | ||
[leiningen.polylith.cmd.info :as info] | ||
[leiningen.polylith.cmd.prompt :as prompt] | ||
[leiningen.polylith.cmd.remove :as remove] | ||
[leiningen.polylith.cmd.settings :as settings] | ||
[leiningen.polylith.cmd.success :as success] | ||
[leiningen.polylith.cmd.sync :as sync] | ||
[leiningen.polylith.cmd.test :as test] | ||
[clojure.stacktrace :as stacktrace] | ||
[leiningen.polylith.cmd.shared :as shared]) | ||
(:import (java.util.concurrent ExecutionException))) | ||
|
||
(defn create-ws? [subtask args] | ||
(and (= "create" subtask) | ||
(or | ||
(= "w" (first args)) | ||
(= "workspace" (first args))))) | ||
[leiningen.polylith.commands :as commands] | ||
[leiningen.polylith.cmd.shared :as shared])) | ||
|
||
(defn ^:no-project-needed polylith | ||
"Helps you develop component based systems" | ||
([_] | ||
(help/execute [] false)) | ||
([project command & cmd-args] | ||
(let [ws-path (:root project) | ||
settings (:polylith project) | ||
top-ns (:top-namespace settings "") | ||
github-url (:github-url settings "") | ||
top-dir (str/replace top-ns #"\." "/") | ||
clojure-version (:clojure-version settings "1.9.0") | ||
args (vec (filter #(not= "-exit" %) cmd-args)) | ||
exit? (not (contains? (set cmd-args) "-exit")) | ||
print-err? (not (contains? (set cmd-args) "-print-err"))] | ||
(if (nil? settings) | ||
(cond | ||
(= "help" command) (help/execute args false) | ||
(create-ws? command args) (create/execute ws-path top-dir top-ns clojure-version args) | ||
:else (println (str "The command must be executed from the workspace root directory. Only 'help' and 'create w' commands can be executed outside of a workspace."))) | ||
(try | ||
(case command | ||
"add" (add/execute ws-path top-dir args) | ||
"build" (build/execute ws-path top-dir args) | ||
"changes" (changes/execute ws-path top-dir args) | ||
"compile" (compile/execute ws-path top-dir args) | ||
"create" (create/execute ws-path top-dir top-ns clojure-version args) | ||
"delete" (delete/execute ws-path top-dir args) | ||
"deps" (deps/execute ws-path top-dir args) | ||
"diff" (diff/execute ws-path args) | ||
;"doc" (doc/execute ws-path top-dir github-url args) | ||
"help" (help/execute args false) | ||
"info" (info/execute ws-path top-dir args) | ||
"prompt" (prompt/execute ws-path top-dir top-ns clojure-version settings github-url args) | ||
"remove" (remove/execute ws-path top-dir args) | ||
"settings" (settings/execute ws-path settings) | ||
"success" (success/execute ws-path args) | ||
"sync" (sync/execute ws-path top-dir) | ||
"test" (test/execute ws-path top-dir args) | ||
(println (str "Command '" command "' not found. Type 'lein polylith' for help."))) | ||
(catch ExecutionException e | ||
(when print-err? | ||
(shared/print-error-message e)) | ||
(when exit? | ||
(System/exit 1))) | ||
(catch Exception e | ||
(shared/print-error-message e) | ||
(System/exit 1))))))) | ||
([project command & args] | ||
(let [{:keys [ok? system-error? exception]} (apply commands/execute project command args)] | ||
(when (not ok?) | ||
(if system-error? | ||
(stacktrace/print-stack-trace exception) | ||
(shared/print-error-message exception)) | ||
(System/exit 1))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.