fix uberjar validation
This commit is contained in:
parent
87c0c53df1
commit
27f3d80643
5 changed files with 70 additions and 9 deletions
|
@ -34,18 +34,23 @@
|
||||||
(if (= ::s/invalid parsed-args-cmd)
|
(if (= ::s/invalid parsed-args-cmd)
|
||||||
(invalid-args-msg ::cmd-args cmd-args)
|
(invalid-args-msg ::cmd-args cmd-args)
|
||||||
(let [{:keys [options args]} parsed-args-cmd
|
(let [{:keys [options args]} parsed-args-cmd
|
||||||
config (slurp (:config args))
|
{:keys [config auth]} args]
|
||||||
auth (slurp (:auth args))]
|
|
||||||
(cond
|
(cond
|
||||||
(some #(= "-h" %) options)
|
(some #(= "-h" %) options)
|
||||||
(println usage)
|
(println usage)
|
||||||
:default
|
:default
|
||||||
(let [config-edn (edn/read-string config)
|
(let [config-str (slurp (:config args))
|
||||||
auth-edn (edn/read-string auth)
|
auth-str (slurp (:auth args))
|
||||||
config-valid? (= ::s/invalid (s/conform ::core/config config-edn))
|
config-edn (edn/read-string config-str)
|
||||||
auth-valid? (= ::s/invalid (s/conform ::core/config auth-edn))]
|
auth-edn (edn/read-string auth-str)
|
||||||
|
config-valid? (s/valid? core/config? config-edn)
|
||||||
|
auth-valid? (s/valid? core/auth? auth-edn)]
|
||||||
(if (and config-valid? auth-valid?)
|
(if (and config-valid? auth-valid?)
|
||||||
(println (core/generate config auth))
|
(println (core/generate config-str auth-str))
|
||||||
(do
|
(do
|
||||||
(when (not config-valid?) (expound-config config-edn))
|
(when (not config-valid?)
|
||||||
(when (not auth-valid?) (expound-config auth-edn))))))))))
|
(println
|
||||||
|
(expound/expound-str core/config? config-edn {:print-specs? false})))
|
||||||
|
(when (not auth-valid?)
|
||||||
|
(println
|
||||||
|
(expound/expound-str core/auth? auth-edn {:print-specs? false})))))))))))
|
||||||
|
|
1
src/test/resources/invalid-auth.edn
Normal file
1
src/test/resources/invalid-auth.edn
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{:xx {}}
|
27
src/test/resources/invalid-config.edn
Normal file
27
src/test/resources/invalid-config.edn
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{:transform [{:source {:source-type :twitter
|
||||||
|
;; optional, defaults to false
|
||||||
|
:include-replies? false
|
||||||
|
;; optional, defaults to false
|
||||||
|
:include-rts? false
|
||||||
|
;; Replace Twitter links by Nitter
|
||||||
|
:nitter-urls? 42
|
||||||
|
;; accounts you wish to mirror
|
||||||
|
:accounts ["arstechnica" "WIRED"]}
|
||||||
|
:target {:target-type :mastodon
|
||||||
|
;; optional flag specifying wether the name of the account
|
||||||
|
;; will be appended in the post, defaults to false
|
||||||
|
:append-screen-name? false
|
||||||
|
;; optional visibility flag: direct, private, unlisted, public
|
||||||
|
;; defaults to public
|
||||||
|
:visibility "unlisted"
|
||||||
|
;; optional boolean to mark content as sensitive. Defaults to true.
|
||||||
|
:sensitive? true
|
||||||
|
;; optional boolean defaults to false
|
||||||
|
;; only sources containing media will be posted when set to true
|
||||||
|
:media-only? true
|
||||||
|
;; optional limit for the post length. Defaults to 300.
|
||||||
|
:max-post-length 300
|
||||||
|
;; optional signature for posts. Defaults to "not present".
|
||||||
|
:signature "#newsbot"}
|
||||||
|
}]
|
||||||
|
:auth {}}
|
1
src/test/resources/valid-auth.edn
Normal file
1
src/test/resources/valid-auth.edn
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{:auth {}}
|
27
src/test/resources/valid-config.edn
Normal file
27
src/test/resources/valid-config.edn
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{:transform [{:source {:source-type :twitter
|
||||||
|
;; optional, defaults to false
|
||||||
|
:include-replies? false
|
||||||
|
;; optional, defaults to false
|
||||||
|
:include-rts? false
|
||||||
|
;; Replace Twitter links by Nitter
|
||||||
|
:nitter-urls? false
|
||||||
|
;; accounts you wish to mirror
|
||||||
|
:accounts ["arstechnica" "WIRED"]}
|
||||||
|
:target {:target-type :mastodon
|
||||||
|
;; optional flag specifying wether the name of the account
|
||||||
|
;; will be appended in the post, defaults to false
|
||||||
|
:append-screen-name? false
|
||||||
|
;; optional visibility flag: direct, private, unlisted, public
|
||||||
|
;; defaults to public
|
||||||
|
:visibility "unlisted"
|
||||||
|
;; optional boolean to mark content as sensitive. Defaults to true.
|
||||||
|
:sensitive? true
|
||||||
|
;; optional boolean defaults to false
|
||||||
|
;; only sources containing media will be posted when set to true
|
||||||
|
:media-only? true
|
||||||
|
;; optional limit for the post length. Defaults to 300.
|
||||||
|
:max-post-length 300
|
||||||
|
;; optional signature for posts. Defaults to "not present".
|
||||||
|
:signature "#newsbot"}
|
||||||
|
}]
|
||||||
|
:auth {}}
|
Loading…
Reference in a new issue